GraphQL-Ruby Newsletter logo

GraphQL-Ruby Newsletter

Subscribe
Archives
January 3, 2024

GraphQL-Ruby 2.2 Update

Hey Everyone,

I recently released GraphQL-Ruby 2.2 to RubyGems, and since it includes some improvements I'm especially excited about, I thought I'd send out a little update. New in GraphQL-Ruby 2.2:

- AsyncDataloader: Finally, a Dataloader that runs I/O in the background! After many attempts, I found a great solution by building on top of the async gem. By switching to this class, your Dataloader sources will run their database queries, network requests, and other I/O tasks in the background instead of blocking execution. Read more in the docs or check out a Rails example app. Special thanks to @ioquatix who answered so many of my questions along the way!

- Parser: @tenderlove demonstrated that a Ruby parser could run faster than a C parser. I integrated his proof of concept into GraphQL-Ruby, so 2.2.0 has a new lexer and parser which is 4-5x faster than the old Ruby parser and uses 25% of the memory. (It's not quite faster than graphql-c_parser, but it's close -- and it uses less memory thanks to its really optimized lexer.)

- Testing: GraphQL-Ruby 2.2.0 includes run_graphql_field, a test helper for running your GraphQL fields outside of a full query. I hope this will make it easier to test different parts of your GraphQL system -- give it a try and let me know what you think!

- Performance: During 2023, I worked with several folks at Shopify to improve GraphQL-Ruby's performance. Compared to December 2022's release (2.0.16), the latest GraphQL-Ruby version is twice as fast and uses less than half as much memory (benchmark)! Of course, there are still things to improve. I'd love to investigate your situation with you; check out the new profiling guide and let me know what you find.

As always, you can find a full list of fixes and improvements in the changelog.

In the meantime, some other GraphQL-Ruby projects have also had some nice improvements:

- graphql-ruby-client now includes GraphiQL "fetcher functions" for using subscriptions over ActionCable, Pusher, or Ably: doc.
- There's a new doc for using GraphiQL along with @defer, too.
- See the JavaScript changelog, GraphQL-Pro changelog, and GraphQL-Enterprise changelog for a full list of fixes and improvements.

Happy New Year!

Robert
Don't miss what's next. Subscribe to GraphQL-Ruby Newsletter:
Docs GitHub
This email brought to you by Buttondown, the easiest way to start and grow your newsletter.