mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix style on vm_ivar benchmarks (#6379)
This commit is contained in:
parent
752ae81ed1
commit
aecb57ceb0
Notes:
git
2022-09-15 09:40:05 +09:00
Merged-By: k0kubun <takashikkbn@gmail.com>
3 changed files with 28 additions and 28 deletions
|
@ -1,33 +1,33 @@
|
|||
prelude: |
|
||||
class Example
|
||||
def initialize
|
||||
@v0 = 1
|
||||
@v1 = 2
|
||||
@v3 = 3
|
||||
@levar = 1
|
||||
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
|
||||
|
||||
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
|
||||
return sum
|
||||
end
|
||||
end
|
||||
|
||||
obj = Example.new
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
prelude: |
|
||||
class Example
|
||||
class Example
|
||||
def read
|
||||
@uninitialized
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
prelude: |
|
||||
class Example
|
||||
class Example
|
||||
def lazy_set
|
||||
@uninitialized ||= 123
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue