Project

General

Profile

Bug #15633

Pathological slowdown in File.expand_path on UNC paths on Windows

Added by djberg96 (Daniel Berger) 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
[ruby-core:91656]

Description

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.

Associated revisions

Revision 95879885
Added by nobu (Nobuyoshi Nakada) 3 months ago

FindFirstFile cannot glob share names

  • win32/file.c (replace_to_long_name): do not try to glob host names and share names by FindFirstFile which is useless for that purpose. [ruby-core:91656] [Bug #15633]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 67163
Added by nobu (Nobuyoshi Nakada) 3 months ago

FindFirstFile cannot glob share names

  • win32/file.c (replace_to_long_name): do not try to glob host names and share names by FindFirstFile which is useless for that purpose. [ruby-core:91656] [Bug #15633]

History

#1

Updated by nobu (Nobuyoshi Nakada) 3 months ago

  • Status changed from Open to Closed

Applied in changeset trunk|r67163.


FindFirstFile cannot glob share names

  • win32/file.c (replace_to_long_name): do not try to glob host names and share names by FindFirstFile which is useless for that purpose. [ruby-core:91656] [Bug #15633]

Also available in: Atom PDF