In Hermes, the JSON.parse speed-up is a whopping 11.2×! (Of course, in Hermes you’d want to precompile the JS and run the bytecode directly, in which case optimizations like this become moot.)
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
That is odd, but seems to make sense. I used to drive other PHP coders crazy by using JSON inline :)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I kept feeling like this wasn't right, but after fixing my own benchmarks to account for v8 caching, I'm getting the same results! The only things I find faster than `JSON.parse` in Node specifically are `require(json_file)` and v8's `deserialize`
-
In case folks are interested, my repo is here:https://github.com/tbranyen/babel-ast-cache-perf-tests …
End of conversation
New conversation -
-
-
Nice yaar

- 1 more reply
New conversation -
-
Can’t JS engines parse object literals as if they were JSON and as soon parsing fails switch to JavaScript syntax? Isn’t it how it works?
-
That sounds like double parsing and is generally something to avoid.
End of conversation
New conversation -
-
-
Is this going to be the next trending rule for everyone?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
What else {} can represent in Javascript that is not json? Now I wonder how larger the json should be to worth make the code less readable and difficult to maintain.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
For large JSON-compatible objects, JSON.parse is faster than JS object literals.
True for all browser JavaScript engines!
