ruby/benchmark/vm_ivar_get.yml

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

38 строки
602 B
YAML
Исходник Обычный вид История

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