RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
| From: | Andrea Giammarchi | Date: | Wed, 07 Oct 2009 15:35:05 +0000 |
| Subject: | RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298730@lists.php.net to get a copy of this message | ||
>
> I can write a test[1] that comes out with these results:
> String concat time: 0.18807196617126
> String interpolation time: 0.14288902282715
> Where using " is faster than ' ! Common wisdom be damned!
where is the test? ... and, is that kind of test where you put 12345678 variables inside a string?
Cause I am developer, not a monkey, obviously if there are more than TOT concatenations to unclude
variables I won't use string concatenation ... now test my case, the string $var instead of
"$var", and come back whenever you want.
> Similarly another test [2] shows that your count() method is less than
> microseconds faster
that's enough for me ... because I don't write 1 line of code, but thousands of lines of
code for an application.
Less than a millisecond for a single loop, means a second when there are a lot of loops.
Micro optimizations, as I said, are simply faster ... and I don't waste any time, I simply know
what could be better, for that circumstance, and I use it. Waste of time is only if you don't
know micro optimizations, to me these are natural, we write same application in the same time, trust
me, except mine will have micro optimizations ... and at the end same development time, faster
result for me, it's 1 plus 1
For those without micro optimizations knowledge, here there is a good start point but there is more:
http://www.alexatnet.com/node/196
Regards, still waiting for a real case scenario where my code style will be slower ( the array , as
$arr[] is the fastest, compare with a function call, array_push, and bring me results if you have
time, but THAT will be a waste of time )
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010