diff options
author | Jeremy Evans <[email protected]> | 2023-04-02 11:28:01 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2023-04-25 08:06:16 -0700 |
commit | a82a24ed575c5f97b3755317f1a3bd6c9149a67e (patch) | |
tree | c057d758345149b10148829eb49cf95bf76dbfbc /spec/ruby/core/regexp | |
parent | 583e9d24d419023bc1123190768297a468113613 (diff) |
Optimize method_missing calls
CALLER_ARG_SPLAT is not necessary for method_missing. We just need
to unshift the method name into the arguments.
This optimizes all method_missing calls:
* mm(recv) ~9%
* mm(recv, *args) ~215% for args.length == 200
* mm(recv, *args, **kw) ~55% for args.length == 200
* mm(recv, **kw) ~22%
* mm(recv, kw: 1) ~100%
Note that empty argument splats do get slower with this approach,
by about 30-40%. Other than non-empty argument splats, other
argument splats are faster, with the speedup depending on the
number of arguments.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7522
Diffstat (limited to 'spec/ruby/core/regexp')
0 files changed, 0 insertions, 0 deletions