From: daniel@... Date: 2015-07-01T14:28:09+00:00 Subject: [ruby-core:69832] [Ruby trunk - Bug #10015] Performance regression in Dir#[] Issue #10015 has been updated by Daniel Rikowski. I ran Adrien's benchmark on Windows: Besides showing a similar performance regression it looks like Dir[] is dramatically slower on Windows: ruby-2.2.2p95: 161.4 ruby-2.1.6p336: 31.8 (Windows 8.1, SSD, NTFS) I guess that is because of the GetFileAttributes vs. stat performance difference. Using Process Monitor I also noticed that in 2.2.2 the (expensive) GetFileAttributesEx function is performed exactly twice as often as in 2.1.6, so part of the problems seems to be repeated (unnecessary?) calls to GetFileAttributes / stat. (Judging from runtime behaviour only) ---------------------------------------- Bug #10015: Performance regression in Dir#[] https://bugs.ruby-lang.org/issues/10015#change-53230 * Author: Aaron Patterson * Status: Feedback * Priority: Normal * Assignee: * ruby -v: ruby 2.2.0dev (2014-02-04 trunk 44802) [x86_64-darwin13.0] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- 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. -- https://bugs.ruby-lang.org/