Project

General

Profile

Actions

Bug #10015

closed

Performance regression in Dir#[]

Added by tenderlovemaking (Aaron Patterson) over 10 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0 [x86_64-darwin13.0]
[ruby-core:63591]

Description

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

Here is the test program:

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.


Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #5994: Dir.glob without wildcards returns pattern, not filenameClosednobu (Nobuyoshi Nakada)02/10/2012Actions
Related to Ruby master - Bug #13167: Dir.glob is 25x slower since Ruby 2.2Closedh.shirosaki (Hiroshi Shirosaki)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0