1
0
Fork 0
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:
Jemma Issroff 2022-07-15 15:18:30 -04:00 committed by Aaron Patterson
parent aed1539ec5
commit f375280d5a
Notes: git 2022-07-16 05:39:23 +09:00
2 changed files with 31 additions and 0 deletions

View 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

View 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