-
-
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
Performance in 1.7.23 vs 9.0.5.0 #3662
Comments
maybe try not running benchmarks in |
@kares please see the linked git repo for reproducing the results from a rake task. |
yeah ... just try running |
@kares @creddy with non-indy support on I do definitely see fib running a bit slower on 9.0.5.0 (MacOS + Java 8u60) than 1.7.25 but I don't find that very important. Also I notice enabling invokedynamic and we get a big drop in perf. So we might want to do some sanity checking on the perf difference in this version of fib...but like I said the numbers are not way off... Why I am really reopening this issue is the massive drop in performance in loading arjdbc gem. What the hell is going on? w/o require:
w/ require
The performance drops in half by loading this library? @kares does activerecord-jdbcsqlite3-adapter monkey patch any core classes? I would not think it could have any effect on this tiny fib method. This is something we should be able to explain. |
Oh, I bet it is monkey patches like |
hmm, wasn't seeing any notable difference as I tried. but you guys are right that require -> |
turns out was running this from under arjdbc repo where I loaded a stub file thus not requiring anything! |
@kares aha...thanks for pointing out ar needs as. @headius we don't keep opted math once we add a new method to the type because any possible call to that type may change fixnum's state internally right? This makes me wonder if we can leverage IR to know whether we are changing internal state. If we do not putfield in the added/replaced method then it can be added to the type and we know normal math still applies. I guess this is an additional burden on us checking to see if the type changed but I can see it as a path to not having this limitation... |
@headius ignore my last question. This is just a simple type guard which is getting set up before AS is loaded since it is the script file. My question about internal state also makes no sense for an immediate type so that would perhaps be a question for a non-immediate type if it ever arises (even then putfield is inadequate due to metaprogramming or eval). |
@enebo, could you clarify your comment regarding the relative performance of 1.7 vs 9.0? You said:
I was hoping that you would find the performance difference to be important. The reason that I have not moved to 9.0 is because we see a significant performance degradation (30% slower) compared to the same app running on 1.7, much like the OP stated, and is in-line with 33% performance degradation in the fib test that the OP presented. I had previously talked about this performance issue in #3595: The spec performance turned out to be a red hearing, but the rails performance is still there, I just had not re-open the issue. |
@ylansegal yeah I am extremely interested in why Rails is not performing well. Fib benchmark, not as much for two reasons:
More generally though when we put out 9k we knew some stuff was a bit slower and others were a bit faster. Our groundwork for larger optimizations (like unboxing mentioned above) will end up putting us into a new realm of performance. More specifically to the reported issue that Rails is not giving the performance relative to 1.7 we need to get some better visibility on why this is. We have gotten several reports of things being slower and some on us being faster on 9k. I suspect there will be some common thread which shows us doing something poorly on 9k that we do not realize yet. |
Thanks @enebo for the explanation. As time permits, I'll try to do some more investigation about which parts slow down our app and report if I find something interesting. |
@enebo and @headius Thank you for taking an interest in this. It is very much appreciated. @kares You mentioned
For when I run benchmarks in the future, would you mind explaining how one would accomplish this in JRuby/JVM? If you have time a pull request against https://github.com/creddy/jruby-bench would be even better. Thank you. |
It seems appropriate to add our own findings regarding the jruby 9k performance problems. We recently tried upgrading one of our core services from 1.7.15 to 9.0.4.0 and saw a similar 20-30% drop in performance. With invokedynamic enabled it was even worse. Some details:
|
Hi, I observed the following: A JRuby program needs 1 minute to load all gems on my laptop. uri:classloader://specifications/asciidoctor-1.5.4.gemspec yields to a new File("//specifications/asciidoctor-1.5.4.gemspec").exists() Under Windows "//specifications" is a network drive, which can not be resolved. Best regards |
@kisho23 najs find, please open a new issue instead of commenting on an unrelated one and if possible include more details. a trace of where that |
Done: |
Those of you who have noticed performance issues, please try 9.1 snapshots from http://ci.jruby.org. Many performance bottlenecks have been fixed. Since we can reproduce this one, I'll poke at it a bit more today. |
Confirmed with 9.1 this perf difference is still there. If my theory is correct we should be able to simulate it by simply modifying Fixnum. |
Ok, unexpectedly, turning off the guard for reopened Fixnum does not appear to make performance return. Continuing to dig. |
Ok, here's my findings. I had not noticed the unusual condition (creating a new Range and calling First off, performance with or without Fixnum reopening guards was about the same as you report, with 9k w/ require performing half as well as 9k w/o require. 9k w/o require on original bench:
9k w/ require on original bench
If I modify the benchmark to use JRuby w/o require:
JRuby w/ require
JRuby w/ require but Fixnum reopening guards disabled:
This tells me that the Fixnum reopening is likely only having a small impact here, but that |
Ok...I think this bug is a red herring. Rails monkey-patches Range#include with a pure-Ruby version: https://github.com/rails/rails/blob/4-2-stable/activesupport/lib/active_support/core_ext/range/include_range.rb Note that this version delegates to the original version when not testing I modified the bench to use FWIW, MRI degrades on the original benchmark as well, but not by as much since they're already quite a bit slower. Ruby 2.3 w/o require
Ruby 2.3 w/ require
I'm going to close this since there's really nothing to fix. Might open a bug to track improvements to our Fixnum/Float reopening logic. |
Thank you for taking the time to investigate 👍 |
I'm hoping for some help in understanding the performance difference I'm seeing when using JRuby 1.7.23 vs 9.0.5.0. During testing, our rails app with its many dependencies showed the difference, but I've worked to distill the example down. The simulated load is from computing a Fibonacci series.
Results
Baseline - JRuby 9.0.5.0 - nothing required
JRuby 1.7.23 - activerecord-jbcsqlite3-adapter required
JRuby 9.0.5.0 - activerecord-jbcsqlite3-adapter required
Setup [https://github.com/creddy/jruby-bench]
JRUBY_OPTS
jruby info
gems
fib.rb
I included the results from 9.0.5.0 without the require since it's a curiosity. My interest is primarily in the difference between the two versions, but it is interesting none the less.
I'm excited to leverage the impressive work that you all have done to bring us 9k and I am happy to provide any additional information or refine my benchmark. Thank you
The text was updated successfully, but these errors were encountered: