https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-02-28T13:39:44ZRuby Issue Tracking SystemRuby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=371802013-02-28T13:39:44Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Tracker</strong> changed from <i>Backport</i> to <i>Bug</i></li><li><strong>Project</strong> changed from <i>Backport200</i> to <i>Ruby master</i></li><li><strong>Priority</strong> changed from <i>5</i> to <i>Normal</i></li></ul><p>jcole1989 (James Coleman) wrote:</p>
<blockquote>
<p>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</p>
</blockquote>
<p>I think it is not apple gcc 4.2 but apple llvm-gcc 4.2.<br>
And did you install latest Command Line Tools with Xcode 4.6?</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=371922013-02-28T22:18:31Zjcole1989 (James Coleman)jtc331@gmail.com
<ul></ul><p>I have the latest command line tools and Xcode 4.6 installed. The gcc error is known, see: <a href="https://bugs.ruby-lang.org/issues/7956" class="external">https://bugs.ruby-lang.org/issues/7956</a> -- the solution was that rvm switched to Clang as the default CC for now.</p>
<p>But all of that still leaves the issue of why the Clang build of 2.0.0 runs so much more slowly than the Clang build of 1.9.3.</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=371932013-03-01T00:43:45Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>ruby -v</strong> set to <i>2.0.0p0 on darwin</i></li></ul><p>jcole1989 (James Coleman) wrote:</p>
<blockquote>
<p>I have the latest command line tools and Xcode 4.6 installed. The gcc error is known, see: <a href="https://bugs.ruby-lang.org/issues/7956" class="external">https://bugs.ruby-lang.org/issues/7956</a> -- the solution was that rvm switched to Clang as the default CC for now.</p>
</blockquote>
<p>It is not apple gcc 4.2, which is the one usually used on linux, but llvm-gcc.<br>
If you want to use normal gcc, you need to install "apple-gcc42" through brew.</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=371972013-03-01T03:21:56Zjcole1989 (James Coleman)jtc331@gmail.com
<ul></ul><p>naruse (Yui NARUSE) wrote:</p>
<blockquote>
<p>It is not apple gcc 4.2, which is the one usually used on linux, but llvm-gcc.<br>
If you want to use normal gcc, you need to install "apple-gcc42" through brew.</p>
</blockquote>
<p>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.</p>
<p>2.0.0p0 (clang): 23.420000 0.010000 23.430000 ( 23.422059)<br>
2.0.0p0 (gcc4.2): 20.270000 0.010000 20.280000 ( 20.273295)<br>
1.9.3p392: 9.460000 0.000000 9.460000 ( 9.465449)</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=372012013-03-01T06:51:11Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin<br>
I cannot reproduce your result:</p>
<p>$ ruby -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }'<br>
ruby 2.0.0p0 (2013-02-24 revision 39473) [x86_64-darwin12.2.1]<br>
10.600000 0.010000 10.610000 ( 10.612499)<br>
$ ruby19 -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }'<br>
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]<br>
11.410000 0.010000 11.420000 ( 11.412127)</p>
<p>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):</p>
<p>$ for f in <code>jot 20</code>; do ruby -rbenchmark -e 'puts Benchmark.measure { 5000000.times { Object.new } }.real'; done > 2_0_0p0.txt<br>
$ for f in <code>jot 20</code>; do ruby19 -rbenchmark -e 'puts Benchmark.measure { 5000000.times { Object.new } }.real'; done > 1_9_3p374.txt<br>
$ ministat 2_0_0p0.txt 1_9_3p374.txt<br>
x 2_0_0p0.txt</p>
<ul>
<li>1_9_3p374.txt<br>
+--------------------------------------------------------------------------+<br>
| + |<br>
| + + |<br>
| xx + + + |<br>
| xxxx x + + ++ + |<br>
|xx xxxxxx xx x x x ++ + ++ + + + +|<br>
| |<strong>M_A</strong>_| |<strong>M_A</strong>__| |<br>
+--------------------------------------------------------------------------+<br>
N Min Max Median Avg Stddev<br>
x 20 1.031859 1.08182 1.045697 1.0484288 0.012780833</li>
<li>20 1.1223431 1.172935 1.1333108 1.1362227 0.01309569<br>
Difference at 95.0% confidence<br>
0.087794 +/- 0.00828168<br>
8.37386% +/- 0.789914%<br>
(Student's t, pooled s = 0.0129392)</li>
</ul>
<p>Here are my CC and CFLAGS settings:</p>
<p>$ ruby -rrbconfig -ve 'p RbConfig::CONFIG.values_at(*%w[CC CFLAGS])'<br>
ruby 2.0.0p0 (2013-02-24 revision 39473) [x86_64-darwin12.2.1]<br>
["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"]</p>
<p>$ ruby19 -rrbconfig -ve 'p RbConfig::CONFIG.values_at(*%w[CC CFLAGS])'<br>
ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]<br>
["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"]<br>
=end</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=372092013-03-01T10:05:44Zged (Michael Granger)ged@FaerieMUD.org
<ul></ul><p>=begin<br>
I also see the same thing Eric does, but with 1.9.3p392:</p>
<p>$ ruby -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }'<br>
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]<br>
9.400000 0.100000 9.500000 ( 9.497637)</p>
<p>$ ruby -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }'<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.1]<br>
10.580000 0.060000 10.640000 ( 10.636003)</p>
<p>=end</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=372162013-03-01T13:18:33Zjcole1989 (James Coleman)jtc331@gmail.com
<ul></ul><p>The only difference in my CFLAGS is that mine also has "-fno-common".</p>
<p>However, I ran:<br>
ruby -rbenchmark -ve 'puts Benchmark.measure { 50000000.times { Object.new } }'<br>
and was unable to reproduce. However, I can reproduce every single time running the same ruby code from within irb. Is there something radically different about how irb runs its interpreter in 2.0.0 versus 1.9.3?</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=372392013-03-02T04:52:22Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin</p>
<p>Even with irb:</p>
<p>$ irb -rbenchmark<br>
irb(main):001:0> RUBY_DESCRIPTION<br>
=> "ruby 2.0.0p0 (2013-02-24 revision 39473) [x86_64-darwin12.2.1]"<br>
irb(main):002:0> Benchmark.measure { 50000000.times { Object.new } }<br>
=> #<Benchmark::Tms:0x007fe212a56e90 @label="", @real=10.025233, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=10.03, @total=10.03></p>
<p>$ irb19 -rbenchmark<br>
irb(main):001:0> RUBY_DESCRIPTION<br>
=> "ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-darwin12.2.1]"<br>
irb(main):002:0> Benchmark.measure { 50000000.times { Object.new } }<br>
=> 14.810000 0.000000 14.810000 ( 14.819111)</p>
<p>Maybe it is due to <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: Irb loading generates 17x more open/stat system calls when a locale is set (Rejected)" href="https://bugs.ruby-lang.org/issues/7778">#7778</a>?<br>
=end</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=372422013-03-02T05:34:59Zjcole1989 (James Coleman)jtc331@gmail.com
<ul></ul><p>I don't have a locale set, so I don't think that that could be the problem.</p>
<p>And even so, how would that affect a tight loop?</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=378702013-03-24T06:34:41Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>This is Linux result</p>
<p>% ruby -v test.rb<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]<br>
3.010000 0.000000 3.010000 ( 3.000945)</p>
<p>% ruby -v test.rb<br>
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]<br>
3.470000 0.000000 3.470000 ( 3.462430)</p>
<p>% ruby -v test.rb<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]<br>
3.060000 0.000000 3.060000 ( 3.056820)</p>
<p>Hm. Someone seems made a regression and fixed it.</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=379582013-03-27T11:46:46Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>sorry, my previous mail has a typo. I've measured them again.</p>
<hr>
<p>% ruby -v ../test63.rb<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]<br>
3.460000 0.000000 3.460000 ( 3.458038)</p>
<p>% ruby -v ../test63.rb<br>
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]<br>
3.820000 0.000000 3.820000 ( 3.811076)</p>
<p>% ruby -v ../test63.rb<br>
ruby 2.1.0dev (2013-03-20 trunk 39832) [x86_64-linux]<br>
3.290000 0.000000 3.290000 ( 3.289948)</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=422252013-10-03T02:46:46Zjcole1989 (James Coleman)jtc331@gmail.com
<ul></ul><p>With 2.0.0-p247 I get:</p>
<p>11.540000 0.010000 11.550000 ( 11.561841)</p>
<p>So apparently whatever the issue was got fixed either in rvm or in Clang or OSX or in the newer patch level of Ruby.</p> Ruby master - Bug #7984: Severe speed issues in 2.0.0 compiled with Clanghttps://bugs.ruby-lang.org/issues/7984?journal_id=422362013-10-03T08:12:04Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul>