Re:Use streaming JSON to reduce latency on mobile
by matharmin on Monday February 19, 2018 @12:17PM
(#16414130)
If you want to parse more than 4GB of JSON in a browser, ArrayBuffer versus string isn't the most important criteria - you shouldn't parse a 4GB ArrayBuffer as a single chunk either. You can always convert between an ArrayBuffer and a string, but you'll want to compare parsers according to the ability to stream, as well as performance and memory efficiency.
Re:Use streaming JSON to reduce latency on mobile
by DvdGiessen on Monday February 19, 2018 @07:14PM
(#16416861)
You could look into streaming parsers such as Oboe.js, which specifically support the use case of parsing JSON tree's larger than the available RAM[0]. Then again, when you're loading such huge JSON files into a 32-bit instance of Chrome, it is likely you should look for a totally different solution to your problem.
[0]: http://oboejs.com/examples#loading-json-trees-larger-than-th...
JSON.parse() only accepts strings.
The library that the article recommends also uses XMLHttpRequest with strings. [2]
The reason I'm asking is the maximum string length in 32-bit Chrome.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequ...
[2]: https://github.com/eBay/jsonpipe/blob/master/lib/net/xhr.js