Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
4 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters