mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eb229994e5
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.
14 lines
189 B
YAML
14 lines
189 B
YAML
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
|