note 98823 deleted from language.operators.increment by danbrown
| From: | danbrown@php.net | Date: | Fri, 09 Jul 2010 15:35:46 +0000 |
| Subject: | note 98823 deleted from language.operators.increment by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170831@lists.php.net to get a copy of this message | ||
Note Submitter: g dot nicolas_89 at hotmail dot fr
----
Note that pre or post incrementation are faster than incrementation by "normal" way
//Starting expression
Expression : $a= 0;
//Key legend
0 for $a++
1 for ++$a
2 for $a+=1
3 for $a = $a + 1
For 2000 iterations :
Test #1 : Array ( [0] => 0.0378229618073 [1] => 0.0375590324402 [2] => 0.0392827987671 [3]
=> 0.0439450740814 )
Test #2 : Array ( [0] => 0.0372891426086 [1] => 0.0379481315613 [2] => 0.0392479896545 [3]
=> 0.0435540676117 )
Test #3 : Array ( [0] => 0.0382251739502 [1] => 0.0380570888519 [2] => 0.0401508808136 [3]
=> 0.0449271202087 )
Test #4 : Array ( [0] => 0.038330078125 [1] => 0.0389108657837 [2] => 0.0397388935089 [3]
=> 0.0445611476898 )
Test #5 : Array ( [0] => 0.0383379459381 [1] => 0.0385930538177 [2] => 0.0400578975677 [3]
=> 0.044585943222 )
Bad way to use $a = $a + 1 ^^