From: "matsuda (Akira Matsuda) via ruby-core" Date: 2022-12-30T03:15:03+00:00 Subject: [ruby-core:111523] [Ruby master Bug#19287] Let DelegateClass respect the original method's arity in case of 0 Issue #19287 has been reported by matsuda (Akira Matsuda). ---------------------------------------- Bug #19287: Let DelegateClass respect the original method's arity in case of 0 https://bugs.ruby-lang.org/issues/19287 * Author: matsuda (Akira Matsuda) * Status: Open * Priority: Normal * ruby -v: ruby 3.3.0dev (2022-12-28T16:43:05Z master cada537040) +YJIT [arm64-darwin21] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- As reported in #19165, method delegation with *, **, and ... adds some overhead for a method that takes no argument. And current implementation of delegations in forwardable and delegate basically define all methods to take splat parameters. But, with regard to DelegateClass, we can investigate the arity of the target methods in the initializer, then we can define the delegation method not to take the splat for zero arity methods. A benchmark on trunk today results in 37% runtime performance improvement on a such method. 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 Patch: https://github.com/ruby/ruby/pull/7045 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/