[BioRuby] Ruby speed

Michael Barton mail at michaelbarton.me.uk
Wed Nov 4 11:24:36 UTC 2009


2009/11/3 Yannick Wurm <yannick.wurm at unil.ch>:
> thanks for your response. I'm running:
> ruby 1.8.6 (2008-03-03 patchlevel 114) [x86_64-linux]
> Starting to age, but on a production machine I'd rather stay with what works
> than risk breaking things by upgrading them.

I think Ruby 1.9 is now the official Ruby release, so you might want
to start trying out using this version, for example Rails 3.0 won't
work with Ruby 1.8.6 anymore. I've tried Ruby 1.9 a bit myself and the
requirements for compatibility are relatively small. If you still
prefer to use 1.8, you could try using REE
(http://www.rubyenterpriseedition.com/) which has a few patches to
improve performance over vanilla 1.8. You could try using
ruby_switcher which makes trying different ruby versions a bit less
painful - http://bit.ly/1kY1Qk

> the command sed 's/^>/>MyPrefix/' is indeed 30% faster than perl :)

Could you just try calling out to sed then?

> I have the feeling that it's ruby's startup-time especially. Running the
> ruby one-liner my a fasta of 40,000 sequences takes 20 seconds; running it a
> fasta of only 10 lines still takes 13 seconds!!

You might also want to try experimenting with gsub! instead of gsub as
the former does destructive in place substitution while the latter
creates an extra object with the substituted text. This extra object
creation might also slow performance.

Cheers Mike



More information about the BioRuby mailing list