Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json-perf-loader, for improved JSON parsing #74

Open
caesarsol opened this issue Sep 14, 2020 · 0 comments
Open

json-perf-loader, for improved JSON parsing #74

caesarsol opened this issue Sep 14, 2020 · 0 comments

Comments

@caesarsol
Copy link
Contributor

caesarsol commented Sep 14, 2020

Suggestion: use json-perf-loader instead of the default webpack JSON loader.

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). Instead of inlining the data as a JavaScript object literal.

As long as the JSON string is only evaluated once, the JSON.parse approach is much faster compared to the JavaScript object literal

I've asked if that is still useful for webpack v4 here, just to be sure it makes sense :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant