Skip to content

Instantly share code, notes, and snippets.

@gmilby
Created July 19, 2013 22:42
Show Gist options
  • Save gmilby/6042890 to your computer and use it in GitHub Desktop.
Save gmilby/6042890 to your computer and use it in GitHub Desktop.
performance test on while loops
Syntax A - 0.25400330 seconds
$i = 0 ;
while($i<1000000){ $i++ ; }
Syntax B - 0.25518957 seconds
$i = 0 ;
while($i<=999999){ $i++ ; }
Syntax C - 0.26488042 seconds
$i = 0 ;
while($i!=1000000){ $i++ ; }
Syntax D - 0.25089923 seconds
$i = 1000000 ;
while($i>0 ){ $i-- ; }
Syntax E - 0.25067065 seconds
$i = 1000000 ;
while($i>=1 ){ $i-- ; }
Syntax F - 0.25501704 seconds
$i = 1000000 ;
while($i!=0 ){ $i-- ; }
Syntax G - 0.16932660 seconds
$i = 1000000 ;
while($i){ $i-- ; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment