From: gminick Date: 2002-09-24T06:41:59+09:00 Subject: Re: Speed up suggestions On Tue, Sep 24, 2002 at 01:35:32AM +0900, gminick wrote: [...] > % cat rb.rb > blah = open('/etc/termcap-BSD', 'r').readlines > % cat ryby.rb > blah = open('/etc/termcap-BSD', 'r').read.split('\n') > > So, I'm assuming that py.py and rb.rb should work faster than > peigrek.py and ryby.rb, because they're using readlines instead > of read and split methods. Let's take a look at the results: > > % time python py.py; time python peigrek.py; time ruby rb.rb; time ruby ryby.rb > python py.py 0.23s user 0.05s system 132% cpu 0.212 total > python peigrek.py 0.23s user 0.06s system 127% cpu 0.227 total > > py.py is faster than peigrek.py - good > > ruby rb.rb 0.74s user 0.06s system 108% cpu 0.735 total > ruby ryby.rb 0.84s user 0.08s system 109% cpu 0.841 total > > rb.rb is faster than ryby.rb OK, i downloaded and installed ruby1.7.3, and... it's faster than older versions of ruby, but still there's a large distance beetwen speeds of python and ruby (py is faster). A little test: ruby1.7.3, blah = open('/etc/termcap-BSD', 'r').readlines % time ruby rb.rb ruby rb.rb 0.40s user 0.09s system 97% cpu 0.500 total ps. for speed maniacs (not me;)): it's time to switch to ruby1.7.3 -- [ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ] [ gminick (at) hacker.pl ][ gminick (at) underground.org.pl/ ]