Issue #7984 has been updated by jcole1989 (James Coleman).


naruse (Yui NARUSE) wrote:
> It is not apple gcc 4.2, which is the one usually used on linux, but llvm-gcc.
> If you want to use normal gcc, you need to install "apple-gcc42" through brew.

I had "apple-gcc42" installed with brew, but I didn't realize that its executable is suffixed with -4.2. I was able to compile 2.0.0 with CC=gcc-4.2. The results would seem to imply that the 2.0.0 speed issue is a problem with Ruby 2.0.0 on OSX in general, not LLVM. The gcc version is faster than the Clang one, but still nowhere near as fast as 1.9.3.

2.0.0p0 (clang): 23.420000   0.010000  23.430000 ( 23.422059)
2.0.0p0 (gcc4.2): 20.270000   0.010000  20.280000 ( 20.273295)
1.9.3p392: 9.460000   0.000000   9.460000 (  9.465449)

----------------------------------------
Bug #7984: Severe speed issues in 2.0.0 compiled with Clang
https://bugs.ruby-lang.org/issues/7984#change-37197

Author: jcole1989 (James Coleman)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 2.0.0p0 on darwin


I've been comparing Ruby 2.0.0 with 1.9.3-head, both compiled with the same basic set of CFLAGs with Clang on Mac OS 10.8 (Mountain Lion). A decent sized rails app was showing performance degradations, so I looked into the most basic of (micro)benchmarks. Running the following:

t = Benchmark.measure do
  50000000.times { Object.new }
end

Gives me the following output:

1.9.3-head: 11.240000 0.000000 11.240000 ( 11.247285)
2.0.0p0: 23.610000 0.010000 23.620000 ( 23.629643)

Ruby 2.0.0 takes over twice as long as 1.9.3. In contrast, running the same test under rubies compiled with GCC on linux (unfortunately I can't do a direct test on OSX because 2.0.0 currently won't compile under the current apple gcc 4.2) Ruby 2.0.0 shows a 15-20% speed improvement over 1.9.3.

So it seems there's a severe speed regression interaction with the ruby 2.0.0 code and Clang.


-- 
http://bugs.ruby-lang.org/