I finally got around to installing PHP on our web
server, and to celebrate the event, I decided to run a
simple benchmark to compare CGI's in C, C++, Perl and
SSI, PHP, and raw HTML. I must admit that the benchmark
was greatly skewed to favor server parsed languages. The
measurement in question was the response time for a
request that would send the following HTML:
<html><body>Hello,world</body></html>
So really the test was about how it it takes to get
started, since the amount of time it takes to send the
result over 10MB Ethernet is less than 1ms. So here are
the results (Linux 2.0.29, Pentium II 233, 64 MB RAM, UW
SCSI, Apache 1.3.6 with PHP 3.0.7):
Method Response time (ms)
static HTML 2
SSI 4
PHP 5
Statically
linked
C CGI 6
Dynamically
linked C CGI 9
Raw Perl CGI 16
Statically
linked C++ CGI 19
Perl CGI
with
require 'cgilib.pl' 37
Dynamically
linked C++ CGI 39
Again this is all about getting started. Just "Hello,
world", that's it. Obviously the results will change
quite a bit on a more complex program. I will probably
do more tests tomorrow and publish the results. If any
body has any suggestions/requests, let me know.
--
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)