Ruby Mail and benchmark.rb on CRuby, JRuby, IronRuby and RubyInstaller
Update: Steve suggested I should try the script also with RubyInstaller, and I did it.
This blog post is update of my recent Ruby Mail on CRuby, JRuby and IronRuby post. Mikel and Jimmy have commented on the post saying I did a poor job, and I would agree. I decided to do a better job this time. Please let me know if measurements can be further improved.
So, I have an e-mail file called 1.eml:
The First Try
This is the test from the first post. (RubyInstaller was not included in the first post.) It is included here so all code and numbers are at the same page, I guess it is easier to compare that way. Read the file, display subject and total time elapsed (in seconds).
Executed the script three times for each Ruby implementation. RubyInstaller the fastest, CRuby and JRuby were similar in speed, IronRuby was way slower.
The Second Try
Since both Mikel and Jimmy said require could take the majority of the time, and I was not really interested in measuring that, I excluded it from the measurement.
Times were way shorter. RubyInstaller the fastest (can not get much faster that 0.0 seconds), CRuby and JRuby in the same order of magnitude, IronRuby order of magnitude slower. JRuby has surprisingly the same numbers every time.
Mikel and Jimmy have suggested that I should use benchmark.rb, so I took a look. I have slightly modified the script. This time the file was read 1000 times.
This measurement said JRuby was the fastest, followed closely by RubyInstaller and CRuby, IronRuby again order of magnitude slower.
Tests were run in VMware Fusion 2.0.6 virtual machine, 512 MB RAM, Microsoft Windows Sever 2003 R2 (Standard Edition, Service pack 2).
Host machine is MacBook Pro, 2.4 GHz Intel Core 2 Duo, Mac OS X 10.6.2, 4 GB RAM.