From: djberg96@... Date: 2019-03-03T12:30:31+00:00 Subject: [ruby-core:91656] [Ruby trunk Bug#15633] Pathological slowdown in File.expand_path on UNC paths on Windows Issue #15633 has been reported by djberg96 (Daniel Berger). ---------------------------------------- Bug #15633: Pathological slowdown in File.expand_path on UNC paths on Windows https://bugs.ruby-lang.org/issues/15633 * Author: djberg96 (Daniel Berger) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- For a while now, including Ruby 2.5, calling File.expand_path on an absolute UNC path seems to be strangely slow. I've put together some benchmarks here: ``` require 'benchmark' MAX = 200000 Benchmark.bm(30) do |x| x.report("expand_path('foo/bar')") do str = "foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('C:/foo/bar')") do str = "C:/foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('//foo/bar')") do str = "//foo/bar" MAX.times{ File.expand_path(str) } end x.report("expand_path('foo//bar///')") do str = "foo//bar///" MAX.times{ File.expand_path(str) } end x.report("expand_path('~')") do str = "~" MAX.times{ File.expand_path(str) } end x.report("expand_path('')") do str = "" MAX.times{ File.expand_path(str) } end x.report("expand_path('', '~')") do MAX.times{ File.expand_path('', '~') } end end ``` What I see is that most of these take only a second or two, while the UNC path takes 30+ seconds. -- https://bugs.ruby-lang.org/ Unsubscribe: