https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112010-03-25T05:55:59ZRuby Issue Tracking SystemRuby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=92902010-03-25T05:55:59Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>drbrain (Eric Hodel)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93352010-03-26T01:22:01Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin<br>
Have you tried trunk? It would be interesting to use gprof to see what the bottleneck is...</p>
<p>-rp<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93482010-03-26T05:39:37ZJiangMiao (Miao Jiang)jiangfriend@gmail.com
<ul></ul><p>=begin<br>
Just tried trunk. ruby 1.9.2dev (2010-03-26 trunk 27048) [i686-linux].<br>
The issue still exists.after install and run foo.rb. It shows<br>
105<br>
109</p>
<p>real 0m0.771s<br>
user 0m0.529s<br>
sys 0m0.177s<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93492010-03-26T06:47:30Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin<br>
It appears that you can avoid the use of gem prelude by doing something like</p>
<p>require 'rubygems'<br>
gem 'xxx'<br>
require 'xxx'</p>
<p>If you run it with 1.9.x with "--disable-gems" thusly, for me it gives</p>
<p>1.8.6: 1.0s<br>
1.9.1 --disable-gems: 1.1s<br>
1.9.1 normal: 4s</p>
<p>Hmm.<br>
Appears that the slowdown (here at least) is by calls to Kernel#require taking quite awhile.<br>
<a href="http://gist.github.com/344167" class="external">http://gist.github.com/344167</a></p>
<p>On Linux for me, however, 1.8.6 takes 0.3s, 1.9.2 (with gem prelude) takes 0.5s, so not as bad of a difference.</p>
<p>-rp<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93532010-03-26T07:24:31Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin<br>
I cannot reproduce with ruby trunk:</p>
<p>$ time ruby19 -v foo.rb<br>
ruby 1.9.2dev (2010-02-09 trunk 26623) [x86_64-darwin10.2.0]<br>
36<br>
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:65: warning: method redefined; discarding old gem<br>
<a href="internal:gem_prelude" class="external">internal:gem_prelude</a>:15: warning: previous definition of gem was here<br>
lib/rational.rb is deprecated<br>
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/uri.rb:7:in <code><top (required)>': warning: URI.escape is obsolete /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/uri.rb:7:in </code><top (required)>': warning: URI.unescape is obsolete<br>
39</p>
<p>real 0m0.477s<br>
user 0m0.314s<br>
sys 0m0.066s</p>
<p>$ time ruby -v foo.rb<br>
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]<br>
11<br>
35</p>
<p>real 0m0.671s<br>
user 0m0.468s<br>
sys 0m0.141s</p>
<p>=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93572010-03-26T08:30:32Zdrbrain (Eric Hodel)drbrain@segment7.net
<ul></ul><p>=begin<br>
On Mar 25, 2010, at 15:45, Roger Pack wrote:<br>
I cannot reproduce with ruby trunk:</p>
<blockquote>
<blockquote>
<p>$ time ruby19 -v foo.rb<br>
ruby 1.9.2dev (2010-02-09 trunk 26623) [x86_64-darwin10.2.0]<br>
36<br>
39</p>
<p>real 0m0.477s</p>
</blockquote>
<p>From his original post:</p>
<p>in 1.9.1 it shows<br>
106<br>
110</p>
<p>it appears that he has a few more gems installed. I think that is<br>
what helps to reproduce it.</p>
</blockquote>
<p>I installed merb on my ruby trunk:</p>
<a name="the-worst-time-I-got-for-ruby-trunk"></a>
<h1 >the worst time I got for ruby trunk<a href="#the-worst-time-I-got-for-ruby-trunk" class="wiki-anchor">¶</a></h1>
<p>$ time ruby19 foo.rb<br>
78<br>
82</p>
<p>real 0m0.579s<br>
user 0m0.382s<br>
sys 0m0.104s</p>
<a name="the-best-time-I-got-for-apple-ruby-187"></a>
<h1 >the best time I got for apple ruby 1.8.7<a href="#the-best-time-I-got-for-apple-ruby-187" class="wiki-anchor">¶</a></h1>
<p>$ time ruby foo.rb<br>
11<br>
35</p>
<p>real 0m0.617s<br>
user 0m0.454s<br>
sys 0m0.120s</p>
<p>=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=93582010-03-26T10:31:10ZJiangMiao (Miao Jiang)jiangfriend@gmail.com
<ul></ul><p>=begin<br>
I trace 'active_record' and found Gem::LoadError has 3 different performance.<br>
version,time,percent<br>
1.8.7 0.106,100%<br>
1.9.2 orignal,0.184,174%<br>
1.9.2 cut $: to $:[-9,9],0.158,149%</p>
<p>My ruby 1.8/1.9 compile step:<br>
./configure optflags=-O3<br>
make -j4<br>
make install</p>
<p>New test code:</p>
<a name="foorb"></a>
<h1 >foo.rb<a href="#foorb" class="wiki-anchor">¶</a></h1>
<p>st=Time.now.to_f<br>
#$:.replace($:[-9,9])<br>
require 'rubygems'<br>
Gem::LoadError<br>
puts Time.now.to_f-st</p>
<p>Test Command:<br>
cat foo.rb;gem environment;(for i in {1..10} ; do ruby foo.rb ; done)|awk '{print $1;s+=$1} END {print "avg:", s/NR}'</p>
<p>Test Result:<br>
1.8.7 0.106 100%<br>
1.9.2 0.184 174%<br>
1.9.2cut 0.158 149%</p>
<p>Test Details:<br>
<a href="http://gist.github.com/344366" class="external">http://gist.github.com/344366</a><br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=106002010-04-28T19:50:23Zdolzenko (Evgeniy Dolzhenko)dolzenko@gmail.com
<ul></ul><p>=begin<br>
I'm getting huge performance hit trying to load whole Facets library:</p>
<blockquote>
<p>cat 1.rb<br>
gem 'facets', '2.8.4'<br>
require 'facets'</p>
</blockquote>
<blockquote>
<p>/usr/bin/time -p ruby -v 1.rb<br>
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]</p>
</blockquote>
<p>real 0.39<br>
user 0.03<br>
sys 0.16</p>
<blockquote>
<p>/usr/bin/time -p ruby -v 1.rb<br>
ruby 1.9.2dev (2010-04-02 trunk 27162) [i686-linux]</p>
</blockquote>
<p>real 6.42<br>
user 2.12<br>
sys 0.92</p>
<p>Profiling results: <a href="http://gist.github.com/381991" class="external">http://gist.github.com/381991</a></p>
<p>Seems to be related to this issue?<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=106192010-04-29T01:46:28Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin</p>
<blockquote>
<blockquote>
<p>I'm getting huge performance hit trying to load whole Facets library:</p>
</blockquote>
</blockquote>
<p>What about if you run it with --disable-gems -- it is fast again?</p>
<p>=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=111552010-05-21T11:47:07Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin<br>
It appears that with --disable-gems 1.9.2 is still <em>significantly</em> slower than 1.8.6 for loading gems.</p>
<p>on my box, require 'facets'</p>
<p>(~80 gems installed)</p>
<p>1.8.6 1.6s<br>
1.9.3dev 3.7s<br>
1.9.3dev --disable-gems 6.7s</p>
<p>using faster_require (which caches lib locations) 0.6s</p>
<p>Curious...<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=124032010-07-18T16:44:23Zsunaku (Suraj Kurapati)sunaku@gmail.com
<ul></ul><p>=begin<br>
Hello,</p>
<p>I am using ruby 1.9.2dev (2010-07-11 revision 28618) [i686-linux]<br>
and this problem seems to be solved in this version. Ruby starts<br>
up just as fast both with and without RubyGems. This is readily<br>
noticeable on my very unpowered computer (slow Intel Atom CPU).</p>
<p>Thanks to the Ruby(Gems) developers and community for fixing this!<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=136492010-10-08T15:08:53Zsunaku (Suraj Kurapati)sunaku@gmail.com
<ul></ul><p>=begin<br>
I think this issue can be closed;<br>
the Ruby 1.9.2 release fixed it.<br>
=end</p> Ruby master - Feature #3010: slow require gems in ruby 1.9.1https://bugs.ruby-lang.org/issues/3010?journal_id=136502010-10-08T15:14:31Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>=begin<br>
thanks for reminder<br>
=end</p>