From: David Garamond Date: 2004-06-21T16:52:00+09:00 Subject: Re: rubys web performance Florian Weber wrote: > its not really a issue with rails.. > > its a issue with the performance ruby reads and compiles files.. > > see my email before about how i tested it. there i only required to > files. no rails stuff going on.. note: php 4.3.6, ruby 1.8.1, both on Linux <<< * 0 line of code: $ time ruby -v; # 0.023s $ time php -v; # 0.037s (note: only mysql.so dynamic PHP extension is loaded; but several exts are builtin) * 1 line of code: $ echo '' | time php -q; # 0.037s $ time ruby -e'puts "Hello, world!"'; # 0.023s * +- 1750 lines of PHP code: $ time php /usr/share/pear/System.php; # 0.058s $ wc System.php PEAR.php Console/Getopt.php 540 2002 17972 System.php 975 3290 30154 PEAR.php 251 1084 9536 Console/Getopt.php 1766 6376 57662 total * +- 2600 lines of Ruby code: $ time ruby cgi.rb; # 0.065s $ wc cgi.rb English.rb delegate.rb 2318 9250 75713 cgi.rb 155 855 5732 English.rb 139 322 2942 delegate.rb 2612 10427 84387 total >>> Conclusion: Not disappointing for Ruby... The problem is, for simple CGI web app, thousands of Ruby lines typically need to be parsed & compiled, while only several lines are needed for PHP (due to PHP extensions are in the form of compiled machine code). Hope things will get better with Cardinal or Ruby2... Overhead of scripting languages compilation (esp. Perl & Ruby, since those doesn't fully support precompiled code) almost always force me to make persistent/long-running processes/daemons (which have problems of their own), or go to C (which I can't stand :-). For example, for an SMTPD I have to ditch qpsmtpd (since the script runs via tcpserver, i.e. needs to be forked on every request) and make my own Perl daemon. The overhead would just really burden my machine. -- dave