From: Thomas Hurst Date: 2002-04-06T19:55:00+09:00 Subject: Re: ruby speed? * Tyler Spivey (tspivey8@telus.net) wrote: > i don't know if this has been issued before, but i'm a ruby newbie and > haven't searched the archives yet. anyway - a perl occur.pl was about > .3 seconds faster then ruby - on an old copying file. This isn't unexpected; speed isn't Ruby's main target. However, if speed is a requirement, Ruby's C API kicks crap out of Perl. > is perl still better at string opperation or is ruby over-all slower? Perl is super-hyper-ultra-mega-optimized for string operations, and it's had a lot of time to mature (and go mouldy ;), so yes, it's faster :) > or is part of that included by the startup time? Ruby is about 5 times slower than Perl on startup, but it about average otherwise, at least on FreeBSD 4.5: -% time ruby /dev/null ruby /dev/null 0.04s user 0.01s system 100% cpu 0.047 total -% time php /dev/null php /dev/null 0.03s user 0.02s system 107% cpu 0.051 total -% time python /dev/null python /dev/null 0.03s user 0.02s system 98% cpu 0.047 total -% time perl /dev/null perl /dev/null 0.00s user 0.01s system 85% cpu 0.009 total On executing a minimal script ('print "Hello, World\n"'), Perl adds 0.001s to that, PHP adds 0.004s, Python adds 0.002s and Ruby adds 0.006s. -- Thomas 'Freaky' Hurst - freaky@aagh.net - http://www.aagh.net/ - You have all eternity to be cautious in when you're dead. -- Lois Platford