ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
@ 2020-08-03 15:19 fitmap
  2020-08-03 18:51 ` [ruby-core:99461] " Greg.mpls
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fitmap @ 2020-08-03 15:19 UTC (permalink / raw)
  To: ruby-core

Issue #17101 has been reported by fitmap (Justin Peal).

----------------------------------------
Bug #17101: YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
https://bugs.ruby-lang.org/issues/17101

* Author: fitmap (Justin Peal)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When use Ruby 2.4, the following program runs fast, After ungrade to Ruby 2.7, the same program runs very very slow. Please unzip the attach first for test.

require 'yaml'
YAML.load_file('qlnv_h_h.yaml')

---Files--------------------------------
qlnv_h_h.7z (1.41 MB)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:99461] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
  2020-08-03 15:19 [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4 fitmap
@ 2020-08-03 18:51 ` Greg.mpls
  2020-08-04 10:13 ` [ruby-core:99476] " gamelinks007
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Greg.mpls @ 2020-08-03 18:51 UTC (permalink / raw)
  To: ruby-core

Issue #17101 has been updated by MSP-Greg (Greg L).


You used the phrase 'runs very very slow'.  I found 2.7 slower, as below.  What were the times you had?

Using Psych.safe_load, got the following for several mingw builds, along with an mswin master build.

All returned a hash with 608 keys.  Tests done on an older slow notebook.

Interesting that the mswin build was much faster than all the others.  I should runs some of the Ruby benchmarks, as that was unexpected.

```
Time  Psych  Ruby
 19   2.2.2  2.4.10
 41   3.0.2  2.5.8
 38   3.1.0  2.6.6
 26   3.1.0  2.7.1
 25   3.1.0  2.8.0dev (2020-08-03T10:46:39Z master 1d637b1f5e) [x64-mingw32]
 12   3.1.0  2.8.0dev (2020-08-03T10:46:39Z master 1d637b1f5e) [x64-mswin64_140]
 ```

----------------------------------------
Bug #17101: YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
https://bugs.ruby-lang.org/issues/17101#change-86918

* Author: fitmap (Justin Peal)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When use Ruby 2.4, the following program runs fast, After ungrade to Ruby 2.7, the same program runs very very slow. Please unzip the attach first for test.

require 'yaml'
YAML.load_file('qlnv_h_h.yaml')

---Files--------------------------------
qlnv_h_h.7z (1.41 MB)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:99476] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
  2020-08-03 15:19 [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4 fitmap
  2020-08-03 18:51 ` [ruby-core:99461] " Greg.mpls
@ 2020-08-04 10:13 ` gamelinks007
  2020-08-04 15:36 ` [ruby-core:99477] " fitmap
  2021-07-02 16:15 ` [ruby-core:104474] " merch-redmine
  3 siblings, 0 replies; 5+ messages in thread
From: gamelinks007 @ 2020-08-04 10:13 UTC (permalink / raw)
  To: ruby-core

Issue #17101 has been updated by S_H_ (Shun Hiraoka).


I tried this benchmark in several ruby's(Ubuntu18.04 in WSL2. using `rbenv`).

```yaml
prelude: |
  require 'yaml'
benchmark: 
  load_file: YAML.load_file('qlnv_h_h.yaml')
loop_count: 1

```


And, result.

```bash
sh@MyComputer:~/rubydev/bugs$ benchmark-driver yml.yaml --output compare --rbenv '2.4.4;2.5.8;2.6.6;2.7.1;2.8.0-dev'
Calculating -------------------------------------
                          2.4.4       2.5.8       2.6.6       2.7.1   2.8.0-dev 
           load_file      0.113       0.075       0.076       0.058       0.134 i/s -       1.000 times in 8.839451s 13.406090s 13.240691s 17.256679s 7.435239s

Comparison:
                        load_file
           2.8.0-dev:         0.1 i/s 
               2.4.4:         0.1 i/s - 1.19x  slower
               2.6.6:         0.1 i/s - 1.78x  slower
               2.5.8:         0.1 i/s - 1.80x  slower
               2.7.1:         0.1 i/s - 2.32x  slower

```

Between `2.5` and `2.7` is slow, but `master(2.8.9-dev)` is very fast(faster than `2.4`!).

And checked `yaml` versions(in theseruby's).

| Ruby version | YAML version |
|:--:|:--:|
|2.8.0-dev | 0.2.5 |
|2.7.1 | 0.2.1 |
|2.6.6 | 0.2.1 |
|2.5.8 | 0.1.7 |
|2.4.4 | 0.1.7 |


----------------------------------------
Bug #17101: YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
https://bugs.ruby-lang.org/issues/17101#change-86931

* Author: fitmap (Justin Peal)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When use Ruby 2.4, the following program runs fast, After ungrade to Ruby 2.7, the same program runs very very slow. Please unzip the attach first for test.

require 'yaml'
YAML.load_file('qlnv_h_h.yaml')

---Files--------------------------------
qlnv_h_h.7z (1.41 MB)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:99477] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
  2020-08-03 15:19 [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4 fitmap
  2020-08-03 18:51 ` [ruby-core:99461] " Greg.mpls
  2020-08-04 10:13 ` [ruby-core:99476] " gamelinks007
@ 2020-08-04 15:36 ` fitmap
  2021-07-02 16:15 ` [ruby-core:104474] " merch-redmine
  3 siblings, 0 replies; 5+ messages in thread
From: fitmap @ 2020-08-04 15:36 UTC (permalink / raw)
  To: ruby-core

Issue #17101 has been updated by fitmap (Justin Peal).


I run this program on Windows 10 64-bit. Very very slow: I wait more than 10 minutes, then I press <Ctrl>-<Break>.

----------------------------------------
Bug #17101: YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
https://bugs.ruby-lang.org/issues/17101#change-86932

* Author: fitmap (Justin Peal)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When use Ruby 2.4, the following program runs fast, After ungrade to Ruby 2.7, the same program runs very very slow. Please unzip the attach first for test.

require 'yaml'
YAML.load_file('qlnv_h_h.yaml')

---Files--------------------------------
qlnv_h_h.7z (1.41 MB)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ruby-core:104474] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
  2020-08-03 15:19 [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4 fitmap
                   ` (2 preceding siblings ...)
  2020-08-04 15:36 ` [ruby-core:99477] " fitmap
@ 2021-07-02 16:15 ` merch-redmine
  3 siblings, 0 replies; 5+ messages in thread
From: merch-redmine @ 2021-07-02 16:15 UTC (permalink / raw)
  To: ruby-core

Issue #17101 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

I tried this on OpenBSD, and ruby 2.7 and 3.0 were faster than ruby 2.4 (all of these use libyaml 0.2.2):

```
/usr/local/bin/ruby27:         0.1 i/s
/usr/local/bin/ruby30:         0.1 i/s - 1.00x  slower
/usr/local/bin/ruby24:         0.0 i/s - 1.46x  slower
/usr/local/bin/ruby26:         0.0 i/s - 1.83x  slower
/usr/local/bin/ruby25:         0.0 i/s - 1.98x  slower
```

I also tested on Windows, where performance on ruby 3.0 and 2.7 is not as good as 2.4, but still much better than 2.5 and 2.6 (these use whatever libyaml is embedded in RubyInstaller):

```
C:\\ruby24-x64\\bin\\ruby:         0.1 i/s
C:\\ruby30-x64\\bin\\ruby:         0.0 i/s - 1.26x  slower
C:\\ruby27-x64\\bin\\ruby:         0.0 i/s - 1.30x  slower
C:\\ruby26-x64\\bin\\ruby:         0.0 i/s - 2.06x  slower
C:\\ruby25-x64\\bin\\ruby:         0.0 i/s - 2.13x  slower
```

It's likely the decrease in performance in Windows on ruby 2.7 and 3.0 is due to different versions of libyaml:

```
D:\>c:\Ruby30-x64\bin\ruby -r yaml -e "p Psych::LIBYAML_VERSION"
"0.2.5"

D:\>c:\Ruby27-x64\bin\ruby -r yaml -e "p Psych::LIBYAML_VERSION"
"0.2.2"

D:\>c:\Ruby26-x64\bin\ruby -r yaml -e "p Psych::LIBYAML_VERSION"
"0.2.1"

D:\>c:\Ruby25-x64\bin\ruby -r yaml -e "p Psych::LIBYAML_VERSION"
"0.1.6"

D:\>c:\Ruby24-x64\bin\ruby -r yaml -e "p Psych::LIBYAML_VERSION"
"0.1.6"
```

There no longer appears to be a massive slowdown, and it appears that for the same libyaml version, ruby 2.7 and 3.0 are faster, so I'm going to close this.

----------------------------------------
Bug #17101: YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4
https://bugs.ruby-lang.org/issues/17101#change-92734

* Author: fitmap (Justin Peal)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x64-mingw32]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
When use Ruby 2.4, the following program runs fast, After ungrade to Ruby 2.7, the same program runs very very slow. Please unzip the attach first for test.

require 'yaml'
YAML.load_file('qlnv_h_h.yaml')

---Files--------------------------------
qlnv_h_h.7z (1.41 MB)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-02 16:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 15:19 [ruby-core:99454] [Ruby master Bug#17101] YAML.load_file: Massive slowdown under Ruby 2.7 vs. Ruby 2.4 fitmap
2020-08-03 18:51 ` [ruby-core:99461] " Greg.mpls
2020-08-04 10:13 ` [ruby-core:99476] " gamelinks007
2020-08-04 15:36 ` [ruby-core:99477] " fitmap
2021-07-02 16:15 ` [ruby-core:104474] " merch-redmine

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).