Add benchmarks for super and zsuper calls of different types

These show gains from the recent optimization commits:

```
                        arg_splat
            miniruby:   7346039.9 i/s
     miniruby-before:   4692240.8 i/s - 1.57x  slower

                  arg_splat_block
            miniruby:   6539749.6 i/s
     miniruby-before:   4358063.6 i/s - 1.50x  slower

                   splat_kw_splat
            miniruby:   5433641.5 i/s
     miniruby-before:   3851048.6 i/s - 1.41x  slower

             splat_kw_splat_block
            miniruby:   4916137.1 i/s
     miniruby-before:   3477090.1 i/s - 1.41x  slower

                   splat_kw_block
            miniruby:   2912829.5 i/s
     miniruby-before:   2465611.7 i/s - 1.18x  slower

                   arg_splat_post
            miniruby:   2195208.2 i/s
     miniruby-before:   1860204.3 i/s - 1.18x  slower
```

zsuper only speeds up in the post argument case, because
it was already set to use splatarray false in cases where
there were no post arguments.
This commit is contained in:
Jeremy Evans 2024-01-25 14:44:11 -08:00
parent 73371450c3
commit f446d68ba6
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,25 @@
prelude: |
@a = [1].freeze
@ea = [].freeze
@kw = {y: 1}.freeze
@b = lambda{}
extend(Module.new{def arg_splat(x=0, y: 0) end})
extend(Module.new{def arg_splat_block(x=0, y: 0) end})
extend(Module.new{def splat_kw_splat(x=0, y: 0) end})
extend(Module.new{def splat_kw_splat_block(x=0, y: 0) end})
extend(Module.new{def splat_kw(x=0, y: 0) end})
extend(Module.new{def splat_kw_block(x=0, y: 0) end})
extend(Module.new{def arg_splat; super(1, *@ea) end})
extend(Module.new{def arg_splat_block; super(1, *@ea, &@b) end})
extend(Module.new{def splat_kw_splat; super(*@a, **@kw) end})
extend(Module.new{def splat_kw_splat_block; super(*@a, **@kw, &@b) end})
extend(Module.new{def splat_kw; super(*@a, y: 1) end})
extend(Module.new{def splat_kw_block; super(*@a, y: 1, &@b) end})
benchmark:
arg_splat: "arg_splat"
arg_splat_block: "arg_splat_block"
splat_kw_splat: "splat_kw_splat"
splat_kw_splat_block: "splat_kw_splat_block"
splat_kw: "splat_kw"
splat_kw_block: "splat_kw_block"

View File

@ -0,0 +1,28 @@
prelude: |
a = [1].freeze
ea = [].freeze
kw = {y: 1}.freeze
b = lambda{}
extend(Module.new{def arg_splat(x=0, y: 0) end})
extend(Module.new{def arg_splat_block(x=0, y: 0) end})
extend(Module.new{def arg_splat_post(x=0, y: 0) end})
extend(Module.new{def splat_kw_splat(x=0, y: 0) end})
extend(Module.new{def splat_kw_splat_block(x=0, y: 0) end})
extend(Module.new{def splat_kw(x=0, y: 0) end})
extend(Module.new{def splat_kw_block(x=0, y: 0) end})
extend(Module.new{def arg_splat(x, *a) super end})
extend(Module.new{def arg_splat_block(x, *a, &b) super end})
extend(Module.new{def arg_splat_post(*a, x) super end})
extend(Module.new{def splat_kw_splat(*a, **kw) super end})
extend(Module.new{def splat_kw_splat_block(*a, **kw, &b) super end})
extend(Module.new{def splat_kw(*a, y: 1) super end})
extend(Module.new{def splat_kw_block(*a, y: 1, &b) super end})
benchmark:
arg_splat: "arg_splat(1, *ea)"
arg_splat_block: "arg_splat_block(1, *ea, &b)"
arg_splat_post: "arg_splat_post(1, *ea, &b)"
splat_kw_splat: "splat_kw_splat(*a, **kw)"
splat_kw_splat_block: "splat_kw_splat_block(*a, **kw, &b)"
splat_kw: "splat_kw(*a, y: 1)"
splat_kw_block: "splat_kw_block(*a, y: 1, &b)"