blob: 9174af6965490c040ff2e10a24fda5b2cdb42be0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
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
|