Skip to content

Instantly share code, notes, and snippets.

@johnborges
Created December 2, 2019 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnborges/732a68801e79c4f0b4cca19e6958e980 to your computer and use it in GitHub Desktop.
Save johnborges/732a68801e79c4f0b4cca19e6958e980 to your computer and use it in GitHub Desktop.
Faster JavaScript Apps with JSON.parse()

Because the JSON grammar is much simpler than JavaScript’s grammar, JSON can be parsed more efficiently than JavaScript. This knowledge can be applied to improve start-up performance for web apps that ship large JSON-like configuration object literals (such as inline Redux stores).

const data = { foo: 42, bar: 1337 }; // 🐌
const data = JSON.parse('{"foo":42,"bar":1337}'); // 🚀
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment