Re:Optimizing Ruby's JSON, Part 1
by lexicality on Wednesday December 18, 2024 @12:43PM
(#42452837)
Possibly I've missed it, but is there anything saying how long the new version takes to parse/encode the Twitter JSON dump with all optimisations applied?
[ Parent
| on HN ]
There's quite a few more commits to go before the final result, but you can see it in the release notes:
- https://github.com/ruby/json/releases/tag/v2.7.3
- https://github.com/ruby/json/releases/tag/v2.8.0Unrelated to json, but a Rails commit by you 2024-10-29: ActiveModel::Type::Integer#serialize 3.17x - 9.67x faster!
https://github.com/rails/rails/commit/70ca4ab91af15714cae4e8...
Note that urls in preformatted text are not rendered as links.
Clickable:
https://github.com/ruby/json/releases/tag/v2.7.3
https://github.com/ruby/json/releases/tag/v2.8.0
Looks like v2.8.0 processes twitter.json at about half a gigabyte/s. The size of twitter.json has changed between the versions, I wonder why that is?
> The size of twitter.json has changed between the versions, I wonder why that is?
For parsing benchmarks, it read the pretty formatted file that is committed in the repository.
But for generation benchmarks it doesn't dump it pretty formatted, so there's much less whitespaces and newlines making the file a bit smaller.