summaryrefslogtreecommitdiff
path: root/spec/ruby/core/numeric
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2023-04-01 20:55:43 -0700
committerJeremy Evans <[email protected]>2023-04-25 08:06:16 -0700
commit9b4bf02aa89fa9a9a568b7be045ab1df8053f0e6 (patch)
treea356df2ef8dfd20f1604cdb23eb3aca07ad7b1e8 /spec/ruby/core/numeric
parentaf2da6419aba1e242e851664b4e6816aeb27f8cb (diff)
Optimize send calls
Similar to the bmethod optimization, this avoids using CALLER_ARG_SPLAT if not necessary. As long as the method argument can be shifted off, other arguments are passed through as-is. This optimizes the following types of calls: * send(meth, arg) ~5% * send(meth, *args) ~75% for args.length == 200 * send(meth, *args, **kw) ~50% for args.length == 200 * send(meth, **kw) ~25% * send(meth, kw: 1) ~115% Note that empty argument splats do get slower with this approach, by about 20%. This is probably because iseq argument setup is slower for empty argument splats than CALLER_SETUP_ARG is. Other than non-empty argument splats, other argument splats are faster, with the speedup depending on the number of arguments. The following types of calls are not optimized: * send(*args) * send(*args, **kw) This is because the you cannot shift the method argument off without first splatting the arg.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7522
Diffstat (limited to 'spec/ruby/core/numeric')
0 files changed, 0 insertions, 0 deletions