“fast code”

I claim professionally that I can write fast code. Most of the time I don't, as I am writing stable code fast. It is much more important to write fast algorithms, and have sensible architectures, than spend ages tweaking your source to the point of unreadability. If we factor my wages versus a better grade of SCSI raid array, large scale rewrites are not cost effective.
Most of my previous commercial experience doing this is actually not-doing-things-unnecessary-things-very-often (e.g. parsing config files), setting up parallel processes carefully, so nothing ever “busy waits” (which is a bigger problem than shallow analysis would tell you, for network heavy problems), and databases.
Specifically at mIS (a tier two UK ISP), the datasets grew by over 1000% as the company expanded whilst I worked there. A simple comparison is not possible as network usage is different over the different network technologies, but as mIS approached enterprise size, we were doing a more mature level of engineering. I was doing business systems, not webpages.
To write fast code, measure everything; and adjust your database indexes, your database settings, your php cache, and your network setup, your kernel io settings. In my experience that is the large slowdowns. If all of those are at their affordable limits, and you need to reduce latency; adjust the way things are done, rather than rewrite code. For example do you actually need to parse XML to achieve your goals?
Having written all of the above, I still can write fast code. UPDATE: Updating to PHP7 is a clear gain.

Third party performance tweaks in PHP

  1. http://blog.digitalstruct.com/2008/01/31/performance-tuning-overview/
    1. This has quite a lot of information, I would rate this one above the other articles in the list. Optimise your site, not your homepage source.
  2. https://developers.google.com/speed/articles/optimizing-php
  3. http://phplens.com/lens/php-book/optimizing-debugging-php.php
    1. this is very old material, but algorithms are algorithms
  4. http://www.slideshare.net/jignesht/performance-tuning-in-php-presentation
  5. http://www.chazzuka.com/63-best-practice-to-optimize-php-code-performances-58/
  6. http://talks.php.net/show/perf_tunning/2
  7. http://ilia.ws/files/phpquebec_2009.pdf
  8. http://chrischarlton.us/tip/php-performance-optimization-and-tuning-tips

Please remember all the adverts by intel about getting a faster CPU to improve your browsing experience. Obviously this was to sell hardware, but in my experience, it won't effect browsing. Better DSL would.
This article was originally a intro to the php-benchmark, but it got too long, so I split it.


PHP performance tweaks

RSS. Share: Share this resource on your twitter account. Share this resource on your linked-in account. G+

PHP performance tweaks

RSS. Share: Share this resource on your linked-in account. Share this resource on your twitter account. G+ ­ Follow