Created
April 18, 2009 17:50
-
-
Save BRMatt/97712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Class Increment extends CodeBench | |
{ | |
public $description = 'Comparision of $i++ to ++$i'; | |
public $loops = 10000; | |
public $subjects = array( | |
// Kinda sporadic jumps, but show a noticeable gap as value increases | |
100, | |
200, | |
300, | |
500, | |
700, | |
1000, | |
10000, | |
100000, | |
); | |
/** | |
* This should be the fastest | |
**/ | |
function bench_pp_i($max) | |
{ | |
for ($i = 0; $i < $max; ++$i) | |
{ | |
} | |
} | |
/** | |
* This should be the slowest | |
**/ | |
function bench_i_pp($max) | |
{ | |
for ($i = 0; $i < $max; $i++) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment