graphql-ruby icon indicating copy to clipboard operation
graphql-ruby copied to clipboard

Refactor Language::Nodes::AbstractNode#initialize

Open rmosolgo opened this issue 1 year ago • 3 comments
trafficstars

It uses keyword arguments which requires Ruby to allocate a Hash. (This is only for .new -> #initialize.) See https://github.com/rmosolgo/graphql-ruby/pull/4718#issuecomment-1850644710

rmosolgo avatar Feb 22 '24 16:02 rmosolgo

If I can get this and this landed in Ruby 3.4, it will eliminate the hash allocation. If you like the kwargs, keep them! 😄

tenderlove avatar Apr 25 '24 00:04 tenderlove

Wow, that would be great. I'll keep an eye on those PRs, thanks!

rmosolgo avatar Apr 25 '24 12:04 rmosolgo

One of the two linked PRs to Ruby is merged... 🤞

rmosolgo avatar Jun 24 '24 17:06 rmosolgo

👋 Hey @tenderlove, are you still considering that PR to do Class#new in Ruby? I'm gearing up for GraphQL-Ruby 3.0 and I'll roll this breaking change to #initialize if necessary.

rmosolgo avatar Nov 18 '24 16:11 rmosolgo

👋 Hey @tenderlove, are you still considering that PR to do Class#new in Ruby? I'm gearing up for GraphQL-Ruby 3.0 and I'll roll this breaking change to #initialize if necessary.

I am, but there's been some blockers so I don't think I'll be able to get this merged until next year maybe. 😭

Please do what you think is best for GraphQL-Ruby and don't wait on me. I think we'll eventually get Ruby changed upstream, but it's going to take more time.

tenderlove avatar Nov 18 '24 16:11 tenderlove

I was able to land an optimization to Class.new for Ruby 3.5, so I'm not sure of this is relevant anymore. IOW it's probably fine to leave the kwargs :)

tenderlove avatar Apr 30 '25 00:04 tenderlove

That's great to hear. Thanks for improving Ruby ... and for updating me!

rmosolgo avatar Apr 30 '25 10:04 rmosolgo