summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2022-07-15 10:12:51 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-07-15 10:29:42 -0400
commitc53439294e390595c88c6f3094021ffc7c0147e1 (patch)
treed3e12af53c5aa22cdab92cd0c94da7935d41418c /benchmark
parent7424ea184f9d67c1c7f3ee97494ed3bd1aa60833 (diff)
downloadruby-c53439294e390595c88c6f3094021ffc7c0147e1.tar.gz
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.
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/vm_ivar_embedded_obj_init.yml6
-rw-r--r--benchmark/vm_ivar_extended_obj_init.yml6
-rw-r--r--benchmark/vm_ivar_set_subclass.yml9
3 files changed, 14 insertions, 7 deletions
diff --git a/benchmark/vm_ivar_embedded_obj_init.yml b/benchmark/vm_ivar_embedded_obj_init.yml
index eed6d4c0b9..74fe20a630 100644
--- a/benchmark/vm_ivar_embedded_obj_init.yml
+++ b/benchmark/vm_ivar_embedded_obj_init.yml
@@ -1,12 +1,14 @@
prelude: |
class C
- def initialize
+ def set_ivars
@a = nil
@b = nil
@c = nil
end
end
+
+ c = C.new
benchmark:
vm_ivar_embedded_obj_init: |
- C.new
+ c.set_ivars
loop_count: 30000000
diff --git a/benchmark/vm_ivar_extended_obj_init.yml b/benchmark/vm_ivar_extended_obj_init.yml
index 994e9e6c49..f054bab282 100644
--- a/benchmark/vm_ivar_extended_obj_init.yml
+++ b/benchmark/vm_ivar_extended_obj_init.yml
@@ -1,6 +1,6 @@
prelude: |
class C
- def initialize
+ def set_ivars
@a = nil
@b = nil
@c = nil
@@ -8,7 +8,9 @@ prelude: |
@e = nil
end
end
+
+ c = C.new
benchmark:
vm_ivar_extended_obj_init: |
- C.new
+ c.set_ivars
loop_count: 30000000
diff --git a/benchmark/vm_ivar_set_subclass.yml b/benchmark/vm_ivar_set_subclass.yml
index 2653d36ded..bc8bf5bf6b 100644
--- a/benchmark/vm_ivar_set_subclass.yml
+++ b/benchmark/vm_ivar_set_subclass.yml
@@ -1,6 +1,6 @@
prelude: |
class A
- def initialize
+ def set_ivars
@a = nil
@b = nil
@c = nil
@@ -10,8 +10,11 @@ prelude: |
end
class B < A; end
class C < A; end
+
+ b = B.new
+ c = C.new
benchmark:
vm_ivar_init_subclass: |
- B.new
- C.new
+ b.set_ivars
+ c.set_ivars
loop_count: 3000000