On Apr 27, 2009, at 21:20, court3nay wrote:
On one machine, I get these numbers
irb(main):003:0> Benchmark.realtime { require ‘tinder’ }
=> 5.7661280632019
same number of gems on both slices?
% gem list | wc -l
are you sure that gem
and ruby
match?
head
2329: /Library/Ruby/Site/1.8/rubygems/source_index.rb
(occur is a simple script I wrote to aggregate input… I loves it)
% cumulative self self total
Gem::Specification#array_attribute
6.67 0.14 0.01 19 0.53 0.53
Regexp#initialize
6.67 0.15 0.01 37 0.27 0.27
Module#attr_accessor
This profile doesn’t find a single gem, try:
ruby -rubygems -e ‘p Gem.source_index.size’
In fact, it didn’t try to even load any gems. There’s no call to
Gem::SourceIndex#load_gems_in and no calls to
Gem::SourceIndex#load_specification.
Even if you don’t have any gems installed and have nuked your repo,
you should call #load_gems_in.
There seems to be something wrong with this RubyGems.
Slow VM:
ruby -r profile -e ‘require “rubygems”’
% cumulative self self total
time seconds seconds calls ms/call ms/call name
1.49 5.97 0.14 14 10.00 397.86
Gem::SourceIndex#load_specification
This profile found 14 gems, but has one fewer require.
Also, is RUBYOPT or RUBYLIB set?
Also:
$ ruby -r profile -e ‘require “rubygems”’
% cumulative self self total
time seconds seconds calls ms/call ms/call name
33.33 0.05 0.05 57 0.88 9.12 Kernel.require
I ran something like this:
$ rm -rf ~/tmp/gems; GEM_HOME=~/tmp/gems GEM_PATH=~/tmp/gems ruby -r
profile -e ‘require “rubygems”’
% cumulative self self total
time seconds seconds calls ms/call ms/call name
27.59 0.08 0.08 54 1.48 14.81 Kernel.require
You seem to have called require more times than me, can you diff
against:
$ ruby -e ‘require “rubygems”; puts $LOADED_FEATURES.sort.join("\n")’
date.rb
date/format.rb
etc.bundle
fileutils.rb
rational.rb
rbconfig.rb
rubygems.rb
rubygems/builder.rb
rubygems/config_file.rb
rubygems/custom_require.rb
rubygems/defaults.rb
rubygems/dependency.rb
rubygems/exceptions.rb
rubygems/gem_path_searcher.rb
rubygems/platform.rb
rubygems/requirement.rb
rubygems/rubygems_version.rb
rubygems/source_index.rb
rubygems/specification.rb
rubygems/user_interaction.rb
rubygems/version.rb
stringio.bundle
syck.bundle
thread.bundle
thread.rb
yaml.rb
yaml/basenode.rb
yaml/constants.rb
yaml/error.rb
yaml/rubytypes.rb
yaml/stream.rb
yaml/syck.rb
yaml/tag.rb
yaml/types.rb
yaml/ypath.rb