> -----Original Message-----
> From: Robert Cummings [mailto:rob...@interjinn.com] 
> Sent: Thursday, March 25, 2010 6:25 AM
> To: Per Jessen
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Will PHP ever "grow up" and have threading?
> Per Jessen wrote:
> > Tommy Pham wrote:
> > 
> >> (I remember a list member, not mentioning his name, does optimization
> >> of PHP coding for just microseconds.  Do you think how much more he'd
> >> benefit from this?)
> > 
> > Anyone who optimizes PHP for microseconds has lost touch with reality -
> > or at least forgotten that he or she is using an interpreted language.
> But sometimes it's just plain fun to do it here on the list with 
> everyone further optimizing the last optimized snippet :)
> Cheers,
> Rob.

Was that someone me? I do that. And if you don't, then you're the kind of
person I would not hire (not saying that to sound mean). I use single
quotes instead of double where applicable. I use -- instead of ++. I use
$boolean = !$boolean to alternate (instead of mod() or other incrementing
solutions). I use "LIMIT 1" on select, update, delete where appropriate. I
use the session to cache the user and even query results. I don't use
bloated frameworks (like Symfony or Zend or Cake or whatever else tries to
be one-size-fits-all). The list goes on.

I would counter and say that if you are NOT optimizing every little drop of
performance from your scripts, then you're either not running a site
sufficiently large enough to matter, or you're doing your customers a

I come from the video game world where gaining a frame or two of animation
per second matters. It makes your game feel less choppy and more fluid and
therefore more fun to play.

If I have to wait 3 seconds for a page to render, that wait is noticeable.
Dumb users will click refresh, and since (unbelievably in this day and age)
PHP and mySQL don't know the user clicked 'stop' or 'refresh', and
therefore mySQL will execute the same query a second time. That's an
entirely different thread I've already ranted on about.

If you can shave off 0.1s from each row of a query result, after only 10
rows, you've saved the user 1 full second. But realistically, you are most
likely displaying hundreds (or in my case, thousands) of rows. Now I've
just saved this user 10s to 100s (that's a minute and a half!)

I'm dealing with TB databases with billions of rows and complex queries
that would make you (and often times me too) cringe in fright. Sure, if
you're dealing with your who-gives-a-shit "blog" website and all 20 entries
of crap-nobody-cares-about, then do whatever you want. But if you're doing
professional, enterprise level work, or have real customers who expect
performance, then you sure as hell better be considering all the ways to
speed up your page. They don't run in a vacuume. They don't just have a
single query.


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

Reply via email to