Archive for August, 2008

Ruby 1.8 vs 1.9 group_by performance

I am working on a ruby project which has cpu intensive tasks so I wanted to see what the impact would be of using the ruby 1.9 development version. It is supposed to provide a major performance increase.

The task used in this project crunches a large amount of data using mathematical functions, array sorting/grouping and database writes.

Ruby versions used for this test:

ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]
ruby 1.9.0 (2008-07-25 revision 18217) [i686-darwin9]

A typical run would take 240sec using ruby 1.8 and 205s with ruby 1.9 without any adaptations: A ~15% speed increase!

I dug a little deeper and found that the array.group_by method was performing a lot faster in ruby 1.9 so i wrote this benchmark to test the increase.

Continue reading ‘Ruby 1.8 vs 1.9 group_by performance’