Skip to content

Commit

Permalink
Add benchmarks for super and zsuper calls of different types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeremyevans committed Mar 1, 2024
1 parent 7337145 commit f446d68
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
25 changes: 25 additions & 0 deletions benchmark/vm_super_splat_calls.yml
@@ -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"
28 changes: 28 additions & 0 deletions benchmark/vm_zsuper_splat_calls.yml
@@ -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)"

0 comments on commit f446d68

Please sign in to comment.