diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-18 17:18:48 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-19 15:18:10 +0900 |
commit | d74fa8e55ce64904f2f99dfef4cbdff94e290672 (patch) | |
tree | 7bfd074fe668f719defa81a3b2fb7b9e291b3aa9 /benchmark/vm2_poly_same_method.yml | |
parent | 9fb9f2d318520ddfdbe73809eea85847550b42ae (diff) |
reuse cc->call
I noticed that in case of cache misshit, re-calculated cc->me can
be the same method entry than the pevious one. That is an okay
situation but can't we partially reuse the cache, because cc->call
should still be valid then?
One thing that has to be special-cased is when the method entry
gets amended by some refinements. That happens behind-the-scene
of call cache mechanism. We have to check if cc->me->def points to
the previously saved one.
Calculating -------------------------------------
trunk ours
vm2_poly_same_method 1.534M 2.025M i/s - 6.000M times in 3.910203s 2.962752s
Comparison:
vm2_poly_same_method
ours: 2025143.9 i/s
trunk: 1534447.2 i/s - 1.32x slower
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2468
Diffstat (limited to 'benchmark/vm2_poly_same_method.yml')
-rw-r--r-- | benchmark/vm2_poly_same_method.yml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/benchmark/vm2_poly_same_method.yml b/benchmark/vm2_poly_same_method.yml new file mode 100644 index 0000000000..867c433cf8 --- /dev/null +++ b/benchmark/vm2_poly_same_method.yml @@ -0,0 +1,25 @@ +prelude: | + module AR; end + class AR::Base + def create_or_update + nil + end + def save + create_or_update + end + end + class Foo < AR::Base; end + class Bar < AR::Base; end + o1 = Foo.new + o2 = Bar.new +benchmark: + vm2_poly_same_method: | + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; + o1.save; o2.save; +loop_count: 6000000 |