Skip to content

fix custom call-site performance regression#5814

Merged
enebo merged 4 commits intomasterfrom
ops-regression
Aug 12, 2019
Merged

fix custom call-site performance regression#5814
enebo merged 4 commits intomasterfrom
ops-regression

Conversation

@kares
Copy link
Member

@kares kares commented Aug 5, 2019

restores interpreter 'fast' Fixnum/Float operations performance, which degraded after doing the isBuiltin checks (#4736)

there's a bit of refactoring needed for the CachingCallSite API used
we're adding a CacheEntry setCache(CacheEntry entry, IRubyObject self)
and checks such as isBuiltin(RubyClass) change to -> isBuitlin(IRubyObject self)
... this is the way JRuby intends to use these APIs anyway, so no harm done there

the gist of better performance is adding logic in custom sites when setCache happens,
do the builtin and target check there so that on the hot-path, taking the direct specific (Fixnum/Float) branch becomes 2 instanceof checks (edit: plus the obvious type "token" check)

@kares kares requested a review from headius August 5, 2019 05:54
@kares
Copy link
Member Author

kares commented Aug 11, 2019

and here's some raw numbers :

jruby -e 'loop { t = Time.now; i = 0; while i < 100_000_000; i+=1; end; puts Time.now - t }'

JRuby 9.2.7.0

0.791033
0.6960909999999999
0.5727019999999999
0.554544
0.54064
0.5588080000000001
0.5369900000000001
0.539406
0.542498
0.542969

master

0.957529
0.912292
0.654926
0.668263
0.61914
0.6145309999999999
0.6088089999999999
0.616993
0.614335
0.624751

this branch

0.879055
0.8296479999999999
0.85761
0.5957279999999999
0.583428
0.5834809999999999
0.5803499999999999
0.584803
0.587146
0.580974

things are much more interesting, when Fixnum gets re-opened (fairly common in gems and the whole point of doing #4736 in the first place) :

jruby -e 'class Fixnum; def some; end end; loop { t = Time.now; i = 0; while i < 100_000_000; i+=1; end; puts Time.now - t }'

JRuby 9.2.7.0

2.400054
2.118736
1.931208
2.02758
2.0146930000000003
2.0489669999999998
1.943752
1.94749
1.93973
1.9508480000000001

this branch (re-opening has no effect)

0.889061
0.794413
0.6611440000000001
0.823025
0.5830369999999999
0.589919
0.589366
0.585882
0.583457
0.5890059999999999

@kares kares added this to the JRuby 9.2.8.0 milestone Aug 11, 2019
@enebo enebo merged commit a91eba5 into master Aug 12, 2019
@kares kares deleted the ops-regression branch August 12, 2019 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants