-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YAML.load significant performance degradation when JSON string is included #5098
Comments
Good find! Investigating. |
SnakeYAML was updated in October, so if that's the culprit it would have first manifested in JRuby 9.1.14. A quick sampled profile shows only one big hot spot, a method in SnakeYAML: |
Ah I see you mention it being slow in 9.1.8.0. I'll start looking there for a possible culprit. |
I traced it to the Psych update in b0487b4. Continuing. |
The only substantive commit in Psych 2.2.3 was ruby/psych@fc55b92, which updated SnakeYAML from 1.17 to 1.18. So we're back to that theory again. |
Manually downgrading SnakeYAML from 1.18 to 1.17 does not resolve the issue, so we're back to Psych being the culprit. |
Manually downgrading Psych to 2.2.2 does appear to remedy the problem, but I'm still confused because there's really nothing different between 2.2.2 and 2.2.3 except for the SnakeYAML update. |
@headius thanks for looking into this and keeping me up-to-date. Hope it gets resolved. |
Ok ignore what I said earlier...after changing all references to "1.18" and manually downgrading SnakeYAML, performance does return to normal. I will check if latest SnakeYAML fixes it and if not I'll file an issue with them. |
It appears this regression was fixed in a later version of SnakeYAML. Updating Psych to a build of 3.0.2 with SnakeYAML 1.20 returns performance to the original range. I will proceed to update Psych. |
great, thank you @headius |
The Psych update is on hold until we can get a fix for https://bitbucket.org/asomov/snakeyaml/issues/401/jrubys-psych-library-uses-markgetindex Hopefully it won't take long. |
Ok, so the bad news is that SnakeYAML 1.19 does not appear to fix the issue, so we'll have to wait for 1.21 that fixes the issue I filed so we can release a new Psych. |
Short term workaround: you may be able to install an older Psych and use it. If you are using Bundler, adding an older Psych version to e.g. For a more permanent solution, you can replace lib/ruby/stdlib/psych* with the contents of the gem's lib dir. There may be some oddities matching versions with the gemspec, so that may need to be replaced under lib/ruby/gems/shared/specifications/default. |
I can confirm that the workaround of downgrading the psych gem works. I added psych version 2.2.2 in my Gemfile.
And added those two lines at the top of the gist.
The output after those changes showed no degradation:
|
If you test SnakeYAML 1.21-SNAPSHOT and it is quick enough, we can release it immediately, otherwise it will be released in August 2018. |
@asomov @vassilios Testing now! |
@asomov @vassilios The 1.21 version of SnakeYAML does indeed fix the performance issue, and requires only minor tweaks to the Psych code. Ship it! 👍 |
@headius thank you for testing it! |
1.21 released. |
@asomov Thank you! |
Is not yet solved ? |
@asomov This issue should not be closed until we have an updated Psych pushed for JRuby 9.1.17. It closed automatically (incorrectly) when I made my commit to Psych. |
This is going to get pushed post-9.1.17 unless we can address the failures from updating Psych and its tests. I got both Psych test failures and YAML failures in the existing ruby specs. |
I have pushed branch |
I will release it in this weekend. |
Environment
jruby 9.1.16.0 (2.3.3) 2018-02-21 8f3f95a OpenJDK 64-Bit Server VM 25.72-b15 on 1.8.0_72-internal-b15 +jit [linux-x86_64]
Linux ip-172-30-3-223 3.13.0-74-generic Bump compilation heap size for jruby-1_6 #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
On jruby 9.1.5.0, 9.1.6.0 and 9.1.7.0, the following gist test_yaml.rb completes in a few milliseconds.
Actual Behavior
The same gist executed with jruby 9.1.8.0 takes more than 10 seconds.
Same thing happens for jruby 9.1.16.0
The text was updated successfully, but these errors were encountered: