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_get.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
602 B
YAML
Raw Normal View History

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