delegate icon indicating copy to clipboard operation
delegate copied to clipboard

Let DelegateClass respect the original method's arity in case of 0

Open amatsuda opened this issue 3 years ago • 1 comments

Further description is at https://bugs.ruby-lang.org/issues/19287

This defines 37% faster method when it takes no argument.

Benchmark: Warming up -------------------------------------- old 551.697k i/100ms new 721.906k i/100ms Calculating ------------------------------------- old 6.511M (± 0.8%) i/s - 33.102M in 5.084530s new 8.925M (± 1.0%) i/s - 44.758M in 5.015619s

Comparison: new: 8924652.2 i/s old: 6510691.1 i/s - 1.37x (± 0.00) slower

amatsuda avatar Dec 30 '22 04:12 amatsuda

This would break if the target method is later redefined with non-0 arity and called with 1+ arguments. I'm not sure how much that matters though.

eregon avatar Dec 30 '22 15:12 eregon