summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-11-06 10:11:20 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2020-11-09 09:44:16 -0800
commiteb229994e5b53e201e776ea103970751d3b1725b (patch)
tree32a14cbd95117defe7aaed2a14b3fe8b8f669f17 /benchmark
parentd14397bcc48b73070953c9fbd410ba435e5f4b8c (diff)
eagerly initialize ivar table when index is small enough
When the inline cache is written, the iv table will contain an entry for the instance variable. If we get an inline cache hit, then we know the iv table must contain a value for the index written to the inline cache. If the index in the inline cache is larger than the list on the object, but *smaller* than the iv index table on the class, then we can just eagerly allocate the iv list to be the same size as the iv index table. This avoids duplicate work of checking frozen as well as looking up the index for the particular instance variable name.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3740
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/vm_ivar_init.yml14
1 files changed, 14 insertions, 0 deletions
diff --git a/benchmark/vm_ivar_init.yml b/benchmark/vm_ivar_init.yml
new file mode 100644
index 0000000000..c6f1633907
--- /dev/null
+++ b/benchmark/vm_ivar_init.yml
@@ -0,0 +1,14 @@
+prelude: |
+ class C
+ def initialize
+ @a = nil
+ @b = nil
+ @c = nil
+ @d = nil
+ @e = nil
+ end
+ end
+benchmark:
+ vm_ivar_init: |
+ C.new
+loop_count: 30000000