4 ms·
> JS engines do regularly have to contend with enormous JSON and do not generally display pathological behavior for large literals Actually it’s common advice
by jitl 3y ago
> JS engines do regularly have to contend with enormous JSON and do not generally display pathological behavior for large literals
Actually it’s common advice to replace very large literals with `JSON.parse(“…”)` because it’s faster according to Chrome engineers [1]. At Notion we did so for our emoji unicode tables for a noticeable time-to-interactive improvement over the large literal.
[1]: https://youtu.be/ff4fgQxPaO0 https://youtu.be/ff4fgQxPaO0
- derefr 3y agoRight, but that's a linear speedup (because the JSON parser is less complex than the JS parser), not a change from superlinear to linear parse time.