ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:91656] [Ruby trunk Bug#15633] Pathological slowdown in File.expand_path on UNC paths on Windows
       [not found] <redmine.issue-15633.20190303123031@ruby-lang.org>
@ 2019-03-03 12:30 ` djberg96
  0 siblings, 0 replies; only message in thread
From: djberg96 @ 2019-03-03 12:30 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-03 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15633.20190303123031@ruby-lang.org>
2019-03-03 12:30 ` [ruby-core:91656] [Ruby trunk Bug#15633] Pathological slowdown in File.expand_path on UNC paths on Windows djberg96

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).