summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-11-09 12:02:20 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2020-11-09 14:05:41 -0800
commitd7581370fd7cef8743c317a1a119215cf064bb73 (patch)
tree79d88e10f95b47871313a5ad6f374cd166fa88c0 /benchmark
parent4219cb7adb0240fa92cd044b2feebb66b7702ca1 (diff)
Add a benchmark for polymorphic ivar setting
This benchmark demonstrates the performance of setting an instance variable when the type of object is constantly changing. This benchmark should give us an idea of the performance of ivar setting in a polymorphic environment
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3750
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/vm_ivar_set_subclass.yml17
1 files changed, 17 insertions, 0 deletions
diff --git a/benchmark/vm_ivar_set_subclass.yml b/benchmark/vm_ivar_set_subclass.yml
new file mode 100644
index 0000000000..2fa995386d
--- /dev/null
+++ b/benchmark/vm_ivar_set_subclass.yml
@@ -0,0 +1,17 @@
+prelude: |
+ class A
+ def initialize
+ @a = nil
+ @b = nil
+ @c = nil
+ @d = nil
+ @e = nil
+ end
+ end
+ class B < A; end
+ class C < A; end
+benchmark:
+ vm_ivar_init: |
+ B.new
+ C.new
+loop_count: 3000000