4
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Aaron Patterson ✅

this would make delegate calls incredibly common, so it's important that they'd be fast. Anyway, if you combine the delegate optimization along with implementing Class#new in Ruby it actually reduces object allocations because passing kwargs across a Ruby to C boundary requires allocating a hash. Here's a screenshot of both patches combined vs Ruby's master branch

Allocation benchmark showing that Ruby's master branch allocates 2 objects for every one object, but the test branch allocates only one.
0
8mo
斎藤ただし

@tenderlove found args🐱, needs args🐆?

0
8mo
Jean Boussier

@tenderlove they are not that rare really. And in go to great length in Rails to not use `...` when possible in `Module#delegate`.

I'd love to burn all this if your patch makes it.

2
8mo
Nony

@tenderlove Interesting, we use delegate calls at Zendesk a lot so optimizing them is super beneficial to us; I should be following this more closely!

0
8mo
Replies