mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add benchmarks for setting / getting ivars on generics
This commit is contained in:
parent
aed1539ec5
commit
f375280d5a
Notes:
git
2022-07-16 05:39:23 +09:00
2 changed files with 31 additions and 0 deletions
17
benchmark/vm_ivar_generic_get.yml
Normal file
17
benchmark/vm_ivar_generic_get.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
prelude: |
|
||||
class C < Array
|
||||
attr_reader :a, :b, :c
|
||||
def initialize
|
||||
@a = nil
|
||||
@b = nil
|
||||
@c = nil
|
||||
end
|
||||
end
|
||||
|
||||
c = C.new
|
||||
benchmark:
|
||||
vm_ivar_generic_get: |
|
||||
c.a
|
||||
c.b
|
||||
c.c
|
||||
loop_count: 30000000
|
14
benchmark/vm_ivar_generic_set.yml
Normal file
14
benchmark/vm_ivar_generic_set.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
prelude: |
|
||||
class C < Array
|
||||
def set_ivars
|
||||
@a = nil
|
||||
@b = nil
|
||||
@c = nil
|
||||
end
|
||||
end
|
||||
|
||||
c = C.new
|
||||
benchmark:
|
||||
vm_ivar_generic_set: |
|
||||
c.set_ivars
|
||||
loop_count: 30000000
|
Loading…
Add table
Reference in a new issue