From: "drbrain (Eric Hodel)" Date: 2013-03-01T06:51:25+09:00 Subject: [ruby-core:53049] [ruby-trunk - Bug #7984] Severe speed issues in 2.0.0 compiled with Clang Issue #7984 has been updated by drbrain (Eric Hodel). I cannot reproduce your result: $ ruby -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }' ruby 2.0.0p0 (2013-02-24 revision 39473) [x86_64-darwin12.2.1] 10.600000 0.010000 10.610000 ( 10.612499) $ ruby19 -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }' ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1] 11.410000 0.010000 11.420000 ( 11.412127) Using ministat for a better comparison I see an 8.4% improvement +/- 0.8% with 1/10th the iterations per sample and 20 samples (overall, double the object creation): $ for f in `jot 20`; do ruby -rbenchmark -e 'puts Benchmark.measure { 5000000.times { Object.new } }.real'; done > 2_0_0p0.txt $ for f in `jot 20`; do ruby19 -rbenchmark -e 'puts Benchmark.measure { 5000000.times { Object.new } }.real'; done > 1_9_3p374.txt $ ministat 2_0_0p0.txt 1_9_3p374.txt x 2_0_0p0.txt + 1_9_3p374.txt +--------------------------------------------------------------------------+ | + | | + + | | xx + + + | | xxxx x + + ++ + | |xx xxxxxx xx x x x ++ + ++ + + + +| | |____M_A_____| |____M_A______| | +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 20 1.031859 1.08182 1.045697 1.0484288 0.012780833 + 20 1.1223431 1.172935 1.1333108 1.1362227 0.01309569 Difference at 95.0% confidence 0.087794 +/- 0.00828168 8.37386% +/- 0.789914% (Student's t, pooled s = 0.0129392) Here are my CC and CFLAGS settings: $ ruby -rrbconfig -ve 'p RbConfig::CONFIG.values_at(*%w[CC CFLAGS])' ruby 2.0.0p0 (2013-02-24 revision 39473) [x86_64-darwin12.2.1] ["clang", " -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -pipe"] $ ruby19 -rrbconfig -ve 'p RbConfig::CONFIG.values_at(*%w[CC CFLAGS])' ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1] ["clang", " -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -pipe"] ---------------------------------------- Bug #7984: Severe speed issues in 2.0.0 compiled with Clang https://bugs.ruby-lang.org/issues/7984#change-37201 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/