зеркало из https://github.com/github/ruby.git
Fixes ivar benchmarks to not depend on object allocation
Prior to this change, we were measuring object allocation as well as setting instance variables within ivar benchmarks. With this change, we now only measure setting instance variables within ivar benchmarks.
This commit is contained in:
Родитель
7424ea184f
Коммит
c53439294e
|
@ -1,12 +1,14 @@
|
||||||
prelude: |
|
prelude: |
|
||||||
class C
|
class C
|
||||||
def initialize
|
def set_ivars
|
||||||
@a = nil
|
@a = nil
|
||||||
@b = nil
|
@b = nil
|
||||||
@c = nil
|
@c = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
c = C.new
|
||||||
benchmark:
|
benchmark:
|
||||||
vm_ivar_embedded_obj_init: |
|
vm_ivar_embedded_obj_init: |
|
||||||
C.new
|
c.set_ivars
|
||||||
loop_count: 30000000
|
loop_count: 30000000
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
prelude: |
|
prelude: |
|
||||||
class C
|
class C
|
||||||
def initialize
|
def set_ivars
|
||||||
@a = nil
|
@a = nil
|
||||||
@b = nil
|
@b = nil
|
||||||
@c = nil
|
@c = nil
|
||||||
|
@ -8,7 +8,9 @@ prelude: |
|
||||||
@e = nil
|
@e = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
c = C.new
|
||||||
benchmark:
|
benchmark:
|
||||||
vm_ivar_extended_obj_init: |
|
vm_ivar_extended_obj_init: |
|
||||||
C.new
|
c.set_ivars
|
||||||
loop_count: 30000000
|
loop_count: 30000000
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
prelude: |
|
prelude: |
|
||||||
class A
|
class A
|
||||||
def initialize
|
def set_ivars
|
||||||
@a = nil
|
@a = nil
|
||||||
@b = nil
|
@b = nil
|
||||||
@c = nil
|
@c = nil
|
||||||
|
@ -10,8 +10,11 @@ prelude: |
|
||||||
end
|
end
|
||||||
class B < A; end
|
class B < A; end
|
||||||
class C < A; end
|
class C < A; end
|
||||||
|
|
||||||
|
b = B.new
|
||||||
|
c = C.new
|
||||||
benchmark:
|
benchmark:
|
||||||
vm_ivar_init_subclass: |
|
vm_ivar_init_subclass: |
|
||||||
B.new
|
b.set_ivars
|
||||||
C.new
|
c.set_ivars
|
||||||
loop_count: 3000000
|
loop_count: 3000000
|
||||||
|
|
Загрузка…
Ссылка в новой задаче