Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
JSON encoder refactor #12183
Nice to have
This is because the new encoder will no longer support encode_json. Therefore our only choice is to return `to_i` or `to_s` in `BigDecimal#as_json`. Since casting a BigDecimal to an integer is most likely a lossy operation, we chose to encode it as a string. Support for encoding BigDecimal as a string will return via the `activesupport-json_encoder` gem.
Got all the tests passing again. Support for `encode_json` has been removed (and consequently the ability to encode `BigDecimal`s as numbers, as mentioned in the previous commit). Install the `activesupport-json_encoder` gem to get it back.
Numers are in!
Full stack benchmark: this uses Discourse's
Raw JSON benchmark: this uses the same Discourse seed data generator and calculates the time it takes to dump various data.
Seems like the patched version is faster than both 4.0.1 and current master!
I also started a draft on a document that goes into details on the expected behaviour of the various components. (I swear it's not as scary as it looks!) The current implementation might not be 100% inline with the draft yet, but we can work on it in future PRs.
I do plan to turn that into a higher-level user guide at some point.