Please help with writing spec for async JSON APIs

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Aug 3 20:18:51 UTC 2015


On Aug 3, 2015, at 12:30 PM, Bruno Jouhier wrote:

> Reviver is a bit of a killer feature for async parsing because it imposes a callback on every key. It makes it difficult to efficiently offload parsing to a worker thread. Without it, feed entries could be parsed and materialized safely (provided GC allows it) in a separate thread and then emitted to the main JS thread.

Exactly, that's why it's naive for anybody to propose that a concurrent JSON reader is simply a matter of wrapping JSON.parse  with some async infrastructure.
> 
> In our "big JSON feeds" scenarios we never use revivers, and actually I'm not sure we even use them on small JSON payloads.
> 
> Is this feature really necessary in an async/incremental API variant?

There's nothing sacred about the JSON.parse `reviver` argument.  It would certainly be possible to have a deserialization function that did not include that functionality.

Allen


More information about the es-discuss mailing list