From: James Gray Date: 2008-12-10T06:58:19+09:00 Subject: Re: Way to many calls to Dir#[] On Dec 9, 2008, at 3:44 PM, Tj Holowaychuk wrote: > its in highline!! I disagree. :) $ grep -c 'Dir' `ruby -e 'puts Dir["lib/**/*.rb"]'` lib/highline/color_scheme.rb:0 lib/highline/import.rb:0 lib/highline/menu.rb:0 lib/highline/question.rb:1 lib/highline/system_extensions.rb:0 lib/highline.rb:0 If you look into that single usage of Dir[], you will see that you must construct a HighLine::Question object and call selection() on it to trigger that code. This does not happen when HighLine loads. > if you put this in any file it calls Dir[] like nuts > > require 'rubygems' > require 'highline/import' > > BUT for anyone else who might run across this, the following cuts this > down to a little over 100 calls to Dir#[], where as the previous is > 600+ > > require 'rubygems' > require 'highline' > require 'highline/import' I assume that's a RubyGems issue with how it figures out to load highline/import. I recommend asking your question on their mailing list. James Edward Gray II