Ruby installed on Ubuntu 10.10 slow on one machine but not other

I have a machine that was provisioned several months ago. RVM was used to install ruby 1.9.3-p125 as well as 1.9.3-p125-perf. When I compared raw ruby performance to another identical machine the older machine smoked them.

For example:

================================================================================
With in-block needle calculation
================================================================================
Rehearsal ----------------------------------------------
detect       3.790000   0.000000   3.790000 (  3.800895)
each         2.410000   0.000000   2.410000 (  2.420860)
any          3.960000   0.000000   3.960000 (  3.972099)
include      1.440000   0.000000   1.440000 (  1.442862)
------------------------------------ total: 11.600000sec

vs

================================================================================
With in-block needle calculation
================================================================================
Rehearsal ----------------------------------------------
detect      10.740000   0.000000  10.740000 ( 10.769366)
each         6.080000   0.010000   6.090000 (  6.106323)
any         10.600000   0.000000  10.600000 ( 10.641606)
include      4.160000   0.000000   4.160000 (  4.171530)
------------------------------------ total: 31.590000sec

I attempted to reinstall 1.9.3-p125 with rvm on the fast machine and that ruby is now slow. It's as if something changed in RVM, or I installed some package that made compiled versions of ruby perform significantly worse.

I know this is a tough question to answer, but what things should I look into in order to track down why the performance has suffered so much?

edit

I just attempted to install with ruby-build and the version installed was fast. Something rvm is doing to build it in my environment is slow.


Solution 1:

The problem has to do with some of the defaults that RVM uses. Two things make a big difference, --disable-shared and --patch cflags.patch

cflags.patch only exists for 1.9.3-p194 and p286 and is automatically added now.

rvm get head && rvm reinstall 1.9.3-p194 --disable-shared --debug

You should see cflags.patch get applied.

If you want the falcon patch too you need to do:

rvm get head && rvm reinstall 1.9.3-p194-perf --patch cflags.patch --patch falcon.diff --disable-shared --debug

Information from: https://github.com/wayneeseguin/rvm/issues/1240