Re: PHP5 Speed Issues

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

 



Hi everyone!

Generaly author of the first e-mail is right. Ofcource, crawling over the
code and getting out of it a few milliseconds off doesn't make it worth, but
you can learn what is good and what is bad and write your code correctly
from the start.
Why not to use
foreach ($data as &$value)
if it's better - faster and takes less memory. That's just a habbit on code
style.
I can bet, that nobody knows or remembers that echo has alternative syntax,
with works faster and is easier to write if you cave to echo a complex
string with many variables and static text, for example

The ordinary:
echo 'Hi! My name is '.$_GET['name'].'. I'm '.$_GET['age'].' and I live in
'.$_GET['country'].'.';

The alternative:
 echo 'Hi! My name is', $_GET['name'], '. I'm ', $_GET['age'], ' and I live
in ', $_GET['country'], '.';

I have an aplication with doesn't eat all CPU, just about 50-60%, but it
eats all 3GB of ram. And not because it is poorly written. It serves ~160
000 - 170 000 requests/hour, that's ~3 960 000 hits a day + another 600 000
hits to the application's WEB part. Just one server could handle, but it
can't because of WEB server's FastCGI implementation (they have a patch for
that soon released).
Just ONE Intel E6600 server with Lighttpd and PHP can handle such load if
the code is optimised and written correctly.

[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