Issue #13167 has been updated by h.shirosaki (Hiroshi Shirosaki).


k0kubun (Takashi Kokubun) wrote:
> After this commit is merged, some CIs that has -DVM_CHECK_MODE=2 and continue to test latest revision started to randomly crash "TestGem#test_load_plugins":
> http://ci.rvm.jp/results/trunk-asserts@silicon-docker
> http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker
> 
> Their logs will be lost after 3 days, so I attach persisted failed logs too:
> https://gist.github.com/ko1/2c905ef9194b727001bea1fa5cb22f70
> https://gist.github.com/ko1/f4f9afb4ea2e48600467ca0a75decd58
> https://gist.github.com/ko1/ba7cc479072764cb46482f112811d4b6
> ... and more
> 

Is that fixed by r64849? Thanks for the patch.



----------------------------------------
Bug #13167: Dir.glob is 25x slower since Ruby 2.2
https://bugs.ruby-lang.org/issues/13167#change-74198

* Author: ahorek (Pavel Rosick)
* Status: Closed
* Priority: Normal
* Assignee: h.shirosaki (Hiroshi Shirosaki)
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Hello,
we've found a huge speed regression in our Rails app. After some digging the reason is in `Dir.glob` method which is much slower since Ruby 2.2.6. This is probably Windows only!

This code is used heavily in Rails for partial lookups:

```ruby
Dir.glob('c:/test/myapp/app/views/common/_menu_stats{.en,}{.html,}{}{.erb,.builder,.raw,.ruby,.jbuilder,.coffee,}')
```

Comparsion (x64):
jruby 9.1.7.0 2540 i/s
ruby 2.1.5 2568 i/s
ruby 2.1.9 2569 i/s
**ruby 2.2.6 99 i/s 25 times slower!
ruby 2.3.3 102 i/s
ruby 2.4.0 103 i/s**

I would like to help, but I don't know much about Ruby C internals. Please let me know if you need any additional info. Now we're stuck at 2.1.9 because this issue makes the development on more recent versions unusable.

---Files--------------------------------
logruby24.txt (484 KB)
logruby21.txt (10.8 KB)
bench_dir_glob.rb (880 Bytes)
0001-dir.c-performance-fix-with-braces-using-cache.patch (5.84 KB)
0001-dir.c-performance-fix-with-braces.patch (8.64 KB)
linux_braces.png (24.1 KB)
linux_list.png (23.5 KB)
linux_recursive.png (26.6 KB)
windows_braces.png (23.6 KB)
windows_list.png (23.1 KB)
windows_recursive.png (28 KB)
bench_dir_glob2.rb (982 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>