Project

General

Profile

Bug #10015

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

r44802 seems to have introduced a performance regression in Dir#[]. 

 Here is the test program: 

 ~~~ruby ~~~ 
 require 'benchmark' 

 puts Benchmark.realtime { 
   glob = "minitest/*_plugin.rb{,.rb,.bundle}" 
   $LOAD_PATH.map { |load_path| 
     Dir["#{File.expand_path glob, load_path}"] 
   }.flatten.select { |file| File.file? file.untaint } 
 } 
 ~~~ 

 Here is the test time for me: 

 ~~~ 
 $ ruby -v test.rb 
 ruby 2.2.0dev (2014-02-04 trunk 44801) [x86_64-darwin13.0] 
 0.000341 
 $ ruby -v test.rb 
 ruby 2.2.0dev (2014-02-04 trunk 44802) [x86_64-darwin13.0] 
 0.009333 
 ~~~ 

 r44801 seems much faster than r44802.

Back