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

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

 




The problem with PHP micro-optimizations like that or ' vs. " is that
PHP rarely bottlenecks a PHP/MySQL application (actually if you run a
dedicated box, see how often your CPU hits 100%, it won't be very
often for the vast majority of PHP/MySQL sites which are more likely
to be disk i/o bound than cpu bound).  The time spent in PHP (by PHP,
not by the database) for page generation is completely negligible and
invisible behind the overhead of network protocols for the vast
majority of sites or drowned in the performance killing of SQL.  I
would probably go so far as to say it doesn't matter how quickly your
PHP runs; you'd save as much time tuning one slow query as you would
micro-optimizing every line of your codebase.  Furthermore, the amount
of time micro-optimization takes up (going through old code, I mean)
could be better spent doing something that actually does increase your
performance, like implementing a search engine or memcached.  Going
forward, if you're aware that ++i and i++ are the same for your
application and ++i is a single php opcode faster (which I don't know
if it's even measurable, that difference), sure go ahead and use ++i
but it's certainly not worth serious thought or developer time.

My two cents.

Eddie:

And thanks for supporting my point.

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