lua-users home
lua-l archive

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


On Sun, Feb 05, 2006 at 02:16:43PM +0300, Markus Walther wrote:
> Klaus Ripke wrote:
> >Jan notes a nice over 30 fold speedup (4900:150)
> >compared to doing the same in PHP.
> >
> 
> That's wrong. The comparison is about simulating caching _in the
> scripting language_ (PHP or Lua would make no difference, I believe), or
> doing it _in the webserver_!
Err, no, not really.

Clearly the CML has kind of an "unfair advantage" by running
inside the webserver. However, Fast-CGI is not that slow.
If you ever compared Apache's mod_php to PHP via Fast-CGI
you know it is not much of a difference (typically about 10%).

Hence http://lighttpd.net/documentation/cml.html does not read
"the main reason is the Fast-CGI communication overhead"
but instead "... the overhead of the PHP interpreter to start up".
And this does not mean to launch a new process,
it's the reinitialization PHP does for every request
inside the persistent Fast-CGI server process.

In one of our customer's project they use Apache/mod_php,
which takes 50ms CPU time on every request before doing any work,
just to reinit and grok a couple 1000 lines of PHP (on a 2.8GHz XEON).
In the same time I can exec a bunch of Lua CGIs.


Yes, PHP or Lua does make a huge difference.
While on plain execution time PHP may only be
a factor of five or so slower on average
http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=lua&lang2=php
the initialization frenzy is an important feature of PHP.


cheers
Klaus