4 ms·
I was hoping this blog post would be about the Chrome team speeding up JSON parsing. On a website I made[1] with a ~1MB JSON ajax payload, Chrome takes about 18
by helpmepropose 7y ago
I was hoping this blog post would be about the Chrome team speeding up JSON parsing. On a website I made[1] with a ~1MB JSON ajax payload, Chrome takes about 18 seconds to parse the JSON, while Safari parses it pretty much instantaneously.
[1] https://helpmepropose.live https://helpmepropose.live
EDIT: Does anyone know if there's something I could do differently to speed this up in Chrome?
- underwater 7y agoWhy not use binary data? A typed array should work (unsure of the exact APIs, though).
- helpmepropose 7y agoHey underwater, I just wanted to follow up and say thanks. Without doing any other optimization, it seems that switching the ajax request from JSON to a big TypedArray changed Chrome's parsing time from 18 seconds to instantaneous: https://helpmepropose.live https://helpmepropose.live Thanks again!
- helpmepropose 7y agoThat's a good idea, thanks! I'd previously thought typed arrays had to be initialized with data that's already in memory, but it looks like I was wrong there. This page is giving some hints that it can be done: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Properties https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequ...