Slow ruby 2.0.0-p0 under Ubuntu 13.04

I had Ruby 2.0.0-p0 working with Ubuntu 12.10, in which a test suite of
mine runs in about 3 minutes. The same test suite takes about 7 min to
complete with Ruby 2.0.0-p0 in Ubuntu 13.04. I’m wondering if something
changed on Ubuntu side that could be causing that.

My machine is a HP Probook with Core i5, 4gb RAM, an SSD disk of 180GB.
My environment consist on rbenv to manage ruby versions, and they are
installed through ruby-build.

Anyone else with the same issue?

This is a known issue of rbenv. It cripples compiler flags, so the
interpreter may run code about 400% slower.

To get rid of this behaviour pass CFLAGS to installation with rbenv
tool.
For example to install Ruby 2.0.0 the command may look like

CFLAGS="-O3 -march=native" rbenv install 2.0.0-p0

On Sun, May 5, 2013 at 2:47 PM, Torimus NA [email protected] wrote:

This is a known issue of rbenv. It cripples compiler flags, so the
interpreter may run code about 400% slower.

When XCode 4.6 was released, it included a new version of Clang that
warned when 64 bit integers were implicitly converted to 32 bit. Ruby
treats all warnings as errors, and existing Ruby 1.9.3 releases had
code that triggered this warning, resulting in a build error on the
new Clang.

(You may recall many recent Ruby commits with messages like “suppress
warnings.” When a new GCC or Clang introduces a new kind of warning,
it breaks the build for all old Ruby releases that trigger the
warning.)

To allow building the latest 1.9.3 patchlevel releases with the new
Clang, ruby-build suppresses the error by adding the
“-Wno-error=shorten-64-to-32” cflag. But! When you configure Ruby with
any CFLAGS set, Ruby omits its own default flags, including -O3,
resulting in a slow, unoptimized build. The work-around is to include
the CFLAGS that Ruby would have used by default:
https://github.com/sstephenson/ruby-build/pull/351

Upgrade ruby-build for a fix.