Re: Performance: While or For loop
| From: | Mario Guenterberg | Date: | Fri, 23 Mar 2007 06:27:49 +0000 |
| Subject: | Re: Performance: While or For loop | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251155@lists.php.net to get a copy of this message | ||
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
Mario
--
-----------------------------------------------------
| 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 |
-----------------------------------------------------