1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/benchmark/vm_ivar_set_on_instance.yml
2022-08-17 10:26:28 -07:00

35 lines
731 B
YAML

prelude: |
class TheClass
def initialize
@v0 = 1
@v1 = 2
@v3 = 3
@levar = 1
end
def set_value_loop
# 1M
i = 0
while i < 1000000
# 10 times to de-emphasize loop overhead
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
@levar = i
i += 1
end
end
end
obj = TheClass.new
benchmark:
vm_ivar_set_on_instance: |
obj.set_value_loop
loop_count: 100