From: Eric Hodel Date: 2007-10-13T18:30:56+09:00 Subject: Re: Import gem to Ruby 1.9 On Oct 13, 2007, at 01:24 , Yukihiro Matsumoto wrote: > In message "Re: Import gem to Ruby 1.9" > on Sat, 13 Oct 2007 15:01:36 +0900, Eric Hodel > writes: > > |Are there any other outstanding issues before I go ahead? > | > |I see a thread in ruby-dev about importing RubyGems, but I cannot > |read Japanese. > > We are discussing how we call rubygems after the merge. Possible > options are: > > (a) just merge; if one wants to load libraries from gems, he needs > to require 'rubygems' first. very traditional, but introduces > unnecessary normal library/gem'ed library separation. > > (b) silently require 'rubygems' in initialization process. rubygems > requires a lot of other libraries, so that memory consumption > might be an issue. > > (c) create (or separate) tiny library only for finding gems, and let > it be loaded in the initialization (from prelude.rb). but no > one knows how easy/difficult to make such a library (yet). > > How do you think? I would like to do (b), but (a) is acceptable to me. I think it is possible to remove most of the files RubyGems loads with require 'rubygems' using caching, which would be an easier alternative to (c), however this would be probably not be much easier. To provide more information, RubyGems has changed the amount of files it loads for require 'rubygems' since 0.9.4 to reduce the amount of memory used and to decrease startup time. Most of the files loaded in 0.9.4 were completely unnecessary. I have 48 gems installed, and these are the differences between RubyGems 0.9.4 and 0.9.4.5. RubyGems 0.9.4: 1.34MB for ruby18 5.36MB for ruby18 + require 'rubygems' 6.63MB for ruby18 + require 'rubygems' + require 'zentest' RubyGems 0.9.4.5: 1.34MB for ruby18 3.26MB for ruby18 + require 'rubygems' 3.85MB for ruby18 + require 'rubygems' + require 'zentest' (I only have ten gems installed in 1.9, so I didn't think it was fair to compare. Ruby 1.9 seems to use more memory than 1.8 in this small test, though.) In total, RubyGems 0.9.4.5 requires 21 additional files on 1.9. The following non-RubyGems files are loading with require 'rubygems': rbconfig.rb thread.rb forwardable.rb rational.rb date/format.rb time.rb On OS X, these six files add ~ 1.5MB. -- Poor workers blame their tools. Good workers build better tools. The best workers get their tools to do the work for them. -- Syndicate Wars