The existing Parser interface is pretty bad, as it forces to
instantiate a new instance for each document.
Instead it's preferable to only take the config and do all the
initialization needed, and then keep the parsing state on the
stack on in ephemeral memory.
This refactor makes the JSON::Coder pull request much easier to
implement in a performant way.
[ruby/json] Refactor JSON::Ext::Parser to split configuration and parsing state
Ref: https://github.com/ruby/json/pull/718
The existing
Parser
interface is pretty bad, as it forces toinstantiate a new instance for each document.
Instead it's preferable to only take the config and do all the
initialization needed, and then keep the parsing state on the
stack on in ephemeral memory.
This refactor makes the
JSON::Coder
pull request much easier toimplement in a performant way.
https://github.com/ruby/json/commit/c8d5236a92
Co-Authored-By: Étienne Barrié [email protected]