Patches item #27982, was opened at 2010-03-17 23:55 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=577&aid=27982&group_id=126
Category: `gem install` Group: None Status: Open Resolution: None Priority: 3 Submitted By: Shri Borde (shrib) Assigned to: Nobody (None) Summary: Gem::Dependency#=~ is slow because it creates a Regexp everytime Initial Comment: Gem::SpecFetcher#find_matching calls Gem::Dependency#=~ more than 10000 times in real-world scenarios when executing "gem install". Hence, Gem::Dependency#=~ needs to be fast. However, it sets and uses the "pattern" local variable as such: pattern = @name pattern = /\A#{Regexp.escape @name}\Z/ unless Regexp === pattern return false unless pattern =~ other.name This is slower than it needs to be. Changing it to the following reduced execution time of a "gem install" command from about 60 seconds down to 40 seconds. if not @pattern @pattern = @name @pattern = /\A#{Regexp.escape @name}\Z/ unless Regexp === @pattern end return false unless @pattern =~ other.name All the RubyGems tests pass with this change. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=577&aid=27982&group_id=126 _______________________________________________ Rubygems-developers mailing list http://rubyforge.org/projects/rubygems Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers