Please help with writing spec for async JSON APIs
allen at wirfs-brock.com
Mon Aug 3 15:34:13 UTC 2015
So, to summarize some things that have been said or are implicit in this thread and related discussions:
1) New JSON APIs could be added to JS. We don’t have to be limited to JSON.parse/stringify
2) We don’t have to be restricted to the JSON.stringify/parse mapping of JS objects from/to JSON texts
3) Streaming is a better processing model for some applications
4) JSON.parse/stringify are pure computational operations. There is no perf benefit to making them asynchronous unless some of their computation can be performed concurrently.
5) You can't just run JSON.parse (or stringify) concurrently with other JS “jobs” because of possible races
6) You could concurrently run the parsing phase of JSON.parse (steps 3-5 of http://ecma-international.org/ecma-262/6.0/#sec-json.parse <http://ecma-international.org/ecma-262/6.0/#sec-json.parse> ).
7) You can not run the step 8 substeps (reviver processing) concurrently because they may call back into JS code and hence could introduce races.
8) Making JSON.stringify concurrent probably requires first copying/transferring the input object graph, but that is essentially the computation that JSON.stringify performs so it is hard to see any benefit.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss