I've just released json 2.7.3 with some bug fixes and lots of performance improvements: https://github.com/ruby/json/releases/tag/v2.7.3

This is my first release after being made maintainer two weeks ago.

If you got some realistic benchmarks in which JSON.dump is significantly slower than an alternative gem, please let me know.

As long as it's not the result of the alternative doing something incorrect, I'll consider it as a bug.

Release v2.7.3 · ruby/json

What's Changed Numerous performance optimizations in JSON.generate and JSON.dump (up to 2 times faster). Limit the size of ParserError exception messages, only include up to 32 bytes of the unpars...

GitHub

@byroot Do I read this as “the `json` gem should be as fast as (for example) `oj`, if not thats a bug?

We have a lot of performance issues in Mastodon due to JSON generation (some API responses are 500kb+ of JSON and thats taking 70% of request time to generate)

@renchap for JSON generation yes.

If you can turn that into an easy to run benchmark of some sort and somehow Oj is faster, I'm happy to take a look.

And even if it's not faster, I'd also be happy to see if I can squeeze some more perf out of `json`.