RE: Whacky increment/assignment logic with $foo++ vs ++$foo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 6:25 PM +0200 10/6/09, Andrea Giammarchi wrote:
er ... tedd, whatever, usually ++i is faster in almost every language, and even C developers could use these kind of micro optimizations.

Speed, even in this SuperCPU era, is still relevant, we would not need benchmark to compare programming languages for each purpose.

Of course in a crappy application, the usage of ++i rather than i++ won't make any difference, but specially for that kind of for loop where there is absolutely no harm or side-effect using ++i rather than i++ ... if ++i could be 0.0001% nobody have a valid reason to avoid it.

Put in this way: I need to do the same thing, one could be better ... why on earth should I use the other way?

I just develop applications, where I can micro-optimize, I do it ... I have never had speed problems, but maybe I am just lucky.

Andrea:

I think you missed my point.

First, you do whatever you want -- do you whatever makes you feel comfortable. I'm not trying to change your ways at all.

Second, to the contrary -- all I am saying is if you have a preference in using ++$i or $i++, then use it. But to say the reason why you use it is because of speed is becoming less of an issue than it was. So much so, that for people to argue either side is rather pointless. There is no significant difference.

Sure we will continue to benchmark the speed of different languages for comparisons, we have a long history/habit of doing that. But that too is becoming less important than it was for what was significant yesterday is not significant today and will be even less so tomorrow.

For example, the Human Gnome Project was first thought to be a project that would take at least 15 years, but it was finished in 5. Why? Because the original projections were based upon the computing power of the day and didn't take into account advances in speed and memory.

So while we can debate computing considerations of today, tomorrow those will be less important. That was the point I was making. Why not focus on things that make significant difference and let the insignificant fade into history.

Look on the bright side, you can tell your grand children "I remember when ++i was faster than i++" and they'll wonder if Mom and Dad were right when they talked about putting you in a rest home.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux