-
-
Notifications
You must be signed in to change notification settings - Fork 64
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 Degradation with 1.5.3 #206
Comments
Thanks for the catch. Do your properties or provider methods use |
No, I don't use But the Arbitrary involved in both extreme cases is quite complicated: I generate variable long lists of which the entries do have to fulfill some consistency rules. To achieve this, I use an integer arbitrary (for the list length) and the apply flatMap to it (for the entries). |
If you find the time could you check if 1.2.4-SNAPSHOT still has the problem.? Just to rule out the obvious. |
This rules out my initial assumption. I'll have to dig deeper. |
I had a look at GC with JFR: nothing suspicious there. |
I guess I've found a "smoking gun": I executed just one of the affected tests (to keep things simple) and found that |
Additionally (and without understanding the context), 2M calls to this method look suspicious when the property gets executed "only" 1.000 times. |
By simple local optimizations of the stream processing, I was able to reduce the test execution time down to 1'00"..1'20", which is not at all ground-breaking, but reinforces my suspicion that this method is part of the problem. |
Thanks for diving deeper. I hope I can find some time during the weekend. |
Don't worry. We can get along quite good with 1.5.2 for now. |
Is |
At leasst it should be stable. |
I think I found the guilty commit: f6a80f4 But that can only be true if the properties in which you're observing the phenomenon uses String generation in some way. |
I deployed my assumed fix to "1.5.4-SNAPSHOT". You may want to try if it fixes your problem. |
I tried my pathological test class with your latest 1.5.4-SNAPSHOT (commit 9998697) and came out with the following run-times:
So, we probably have some improvement but also a high variance. |
Without the additional improvement from your PR I'd expect some slow down b/c string generation will inject duplicate chars on purpose. The number of calls to StoreRepository#get should have gone down by an order of magnitude though. |
This is a small Kotlin reproducer for the effect: Issue206Reproducer.zip Measured run-times are
The generation logic is essentially the same as in my "real" Arbitrary. I just left out business constraints, types, etc. I'll try testing the combination of your and mine improvement later. |
If you want to minimize variance you can fix the seed. But you probably know that. |
@tmohme I used your reproducer to decide that generated strings will no longer explicitly duplicate characters by default. There's still s.t. a ~30% performance hit that I currently cannot pin down. Will further investigate. |
I can trace the 30% performance hit to a change in
|
I tested commit 1.5.4-SNAPSHOT (1a8d05e) with good results. Btw.: The number of calls to |
is it higher with 1.5.4-S than with 1.5.2? If so, that will be one more riddle to solve before closing this issue |
A comparison for one test with fixed seed:
In my interpretation the most important contributors to improvement of the run-time (1.5.4-SN vs. 1.5.3) are
With the current 1.5.4-SN, my proposed change to the data-structure is probably even contra-productive as a linear search over only two elements should be faster than a lookup in a HashMap (let alone having to maintain more complicated code). |
Still wondering where the 40+ thousand calls come from. But that's peanuts ;-/
I guess it doesn't matter for two entries anyway. And the number of entries can grow rapidly as soon as stuff like |
Closing as fixed. Reopen if new performance issues show up. |
Testing Problem
I'm experiencing a significant performance degradation with 1.5.3 (compared to 1.5.2).
While the overall runtime of the complete test suite roughly doubled (662 tests, ~6'40" => ~13'00"), some tests are hit exceptionally hard: I've identified two classes that went from 6s resp. 8s to 1'40"
A CPU flame-graph of the 6s test class ("TRFP"):

This is the corresponding flame-graph of the same test class running 1'54" with 1.5.3:

Hope this helps to identify the root cause or suggest a workaround.
Please let me know if you need further/other measurements.
The text was updated successfully, but these errors were encountered: