Mailinglisten-Archive |
Hallo Liste, Alexander Wagner schrieb am Donnerstag, 1. November 2001, 16:30 AW> Weiß es vielleicht irgendwer genau? folgendes Test-Script: === schnipp === include "class.timer.php"; $t = new Timer; unset($array); for ($i = 0; $i < 100000; $i++) { $array[] = $i; } reset($array); unset($test); $t->new_timer("While-Schleife", 1); while (list($key ,$val) = each ($array)) { $test = $val; } $t->stop(); reset($array); unset($test); $t->new_timer("Foreach-Schleife", 1); foreach ($array AS $key => $val) { $test = $val; } $t->stop(); $t->echoalltimers(); === schnapp === Ergebnis: Linux ================= Dedicated Server Betriebssystem SuSE Linux 7.1 Professional Server-Software Apache 1.3.20 PHP4.0.5 GDLib (PNG/JPEG), PDFLib, FTP, ZLib, Sockets Prozessor: Pentium III 866 MHz Arbeitsspeicher 512 MB RAM Timer 1: While-Schleife - 0.6676070690155 Timer 2: Foreach-Schleife - 0.38182199001312 Timer 1: While-Schleife - 0.67957305908203 Timer 2: Foreach-Schleife - 0.34047400951385 Timer 1: While-Schleife - 0.82154405117035 Timer 2: Foreach-Schleife - 0.33992910385132 Timer 1: While-Schleife - 0.93087792396545 Timer 2: Foreach-Schleife - 0.34347999095917 Timer 1: While-Schleife - 0.66944897174835 Timer 2: Foreach-Schleife - 0.34384191036224 Windows ================= Entwicklungs-Rechner Betriebssystem Windows 98 SE Server-Software Apache 1.3.20 PHP4.0.6 GDLib (PNG/JPEG), FTP, ZLib, Sockets Prozessor: AMD Duron 700_(at)_900 Arbeitsspeicher 320 MB RAM Timer 1: While-Schleife - 1.4605090618134 Timer 2: Foreach-Schleife - 0.84429407119751 Timer 1: While-Schleife - 1.4254529476166 Timer 2: Foreach-Schleife - 0.86732399463654 Timer 1: While-Schleife - 1.4688450098038 Timer 2: Foreach-Schleife - 0.85440397262573 Timer 1: While-Schleife - 1.3974949121475 Timer 2: Foreach-Schleife - 0.85856401920319 Timer 1: While-Schleife - 1.4024580717087 Timer 2: Foreach-Schleife - 0.84077894687653 Zeitangaben jeweils in Sekunden. Tschüß, Lars -- Lars Volkhardt APP - Another PHP Programs http://www.php-zentrale.de mailto:snoopy_(at)_php-zentrale.de
php::bar PHP Wiki - Listenarchive