mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
4219cb7adb
commit
d7581370fd
Notes:
git
2020-11-10 07:06:06 +09:00
1 changed files with 17 additions and 0 deletions
17
benchmark/vm_ivar_set_subclass.yml
Normal file
17
benchmark/vm_ivar_set_subclass.yml
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue