3 ms·
Parsing JSON is tricky, you need to figure out the structure as you go. JavaScript implementations can reuse their JIT machinery to figure out the structure of
by inglor 5y ago
Parsing JSON is tricky, you need to figure out the structure as you go. JavaScript implementations can reuse their JIT machinery to figure out the structure of parsed JSON (here's shapes if you're not familiar https://mathiasbynens.be/notes/shapes-ics https://mathiasbynens.be/notes/shapes-ics )
You _can_ do it outside the engine but it'd be tricky and you'd have to either write a lot of code _or_ to trick the engine to reuse the JIT machinery for your parser.
Protocols with schemas are much much easier to parse efficiently so I suspect it'd be as fast in library written JS.