Re: Performance: While or For loop
| From: | Tijnema ! | Date: | Fri, 23 Mar 2007 14:50:12 +0000 |
| Subject: | Re: Performance: While or For loop | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251171@lists.php.net to get a copy of this message | ||
On 3/23/07, Mario Guenterberg <mg@havelsoft.com> wrote:
On Fri, Mar 23, 2007 at 12:24:45AM -0500, Travis Doherty wrote: After multiple runs I see that the for pre-increment loop is fastest. Note that the while loop with a post-increment runs once more than with a pre-increment. Everytime I run, the results are *very* different, though still fall within similar comparitive domains. Hi... I used your script and my results are different from yours. The post-while increment is generally the fastest result on my machine (Core 2 Duo, php 5.2.1 and apache 2.2.4). I ran the script multiple times: [schnipp ] For pre-increment (100000): 0.066 For post-increment (100000): 0.066 While pre-increment (100000): 0.028 While post-increment (100001): 0.025 [schnipp ] Greetings MarioWell, myh results are a little bit confusing again, if using pre-increment, for shows up faster now. But while post-increment is the fastest :) Is there any logic why we all have different results? does it has to do something with the type of CPU, i'm using AMD Athlon. 1800+ (clocked down from 133 to 100 * 11.5) For pre-increment (100000): 0.026 For post-increment (100000): 0.030 While pre-increment (100000): 0.029 While post-increment (100001): 0.023 Tijnema ps. @ Mario: Youre C2D got owned by a AMD 1.15Ghz :)
-- ----------------------------------------------------- | havelsoft.com - Ihr Service Partner für Open Source || Tel: 033876-21 966 | | Notruf: 0173-277 33 60 | | http://www.havelsoft.com | | | | Inhaber: Mario Günterberg | | Mützlitzer Strasse 19 | | 14715 Märkisch Luch |----------------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php