Quite recently, in many ruby blogs, communities, and even
in Habré , many posts have been written that RVM has a bad effect on the performance of the MRI version of ruby (the official language interpreter) due to the fact that the installer does not take into account optimization of the GCC compiler. Of course, there were “medications” for this ailment, but they had to be applied with pens, and quite straight. So, I hasten to please everyone that in the latest versions of RVM (starting with version 1.17.0) the situation has changed, and of course for the better, now you can rely on the version manager ruby again. All you need to do is upgrade to the latest version.
For those who do not know how or have forgotten how it is done, I will.
We start the terminal, and we write:
$ rvm get stable
RVM pulls the latest stable version of itself, restarts, and displays a standard message with the result of the update and thanks for the use of the well-known Wayne E. Seguin, the author of this package.
After the RVM has been updated, you need to recompile the installed MRI versions of ruby, and even better, install the latest one. At the time of writing this post, the latest stable versions are:
RVM - 1.17.2 and
Ruby - 1.9.3-p327 . Recompiling ruby with RVM is very simple:
$ rvm reinstall 1.9.3
To use the newly installed version of ruby by default, run:
$ rvm use 1.9.3 --default
In addition to processor optimizations, RVM now knows about the
funny-falcon patch and puts it with all the latest versions for which it exists. The performance
boost is obvious, on my
Intel® Core (TM) i5-2320 CPU @ 3.00GHz with four gigs of RAM under
Ubuntu 12.04 , a typical benchmark gives the following results:
Before
(RVM - 1.16.17, Ruby - 1.9.3-p286) $ time ruby -e "count = 0; while(count < 100000000); count = count + 1; end; puts count" 100000000 real 0m5.303s user 0m5.244s sys 0m0.016s
After
(RVM - 1.17.2, Ruby - 1.9.3-p327) $ time ruby -e "count = 0; while(count < 100000000); count = count + 1; end; puts count" 100000000 real 0m1.940s user 0m1.932s sys 0m0.004s
Well, that's all. Thank you for your attention, as they say - Happy Hacking!
')
Update: for
Mac OS X 10.6 and higher .
To explicitly compile when installing Ruby, you may need to add the option
--with-gcc=clang
, that is:
$ rvm reinstall 1.9.3 --with-gcc=clang
Thanks to the user
virusman for this tip.