-
Notifications
You must be signed in to change notification settings - Fork 82
Usage of "\t" in JSON.stringify makes webpack needlessly slow #31
Comments
I think it makes sense to always use @sokra, do you know what the initial reason was to use |
To be more readable. But now devtools can reformat code so this is no longer needed. |
Thank you so much for the quick response! Any chance of pushing this into an official release on github/npm? Right now I'm including it in my package.json via the commit hash. Thanks again! |
@SpaceK33z @sokra: Sorry to be a pest, but I'm not sure if my previous comment was seen after the issue was closed. As per my last comment, since a good portion of the code changed (which given its size and simplicity, any change is somewhat significant), does it warrant a version update and publishing? |
@thejonwithnoh, we will release a new major version around the webpack v2 stable release (which shouldn't be too long). This will also contain #35, which is a breaking change too. |
Should the returned value really be constructed with
JSON.stringify(value, undefined, "\t")
? Specifically the"\t"
could be problematic, and slow down webpack. What's wrong with using something else, such assource
for example?In my project, I'm loading a JSON file that contains a 512x512 matrix of data. In my original file, this takes up 512 lines of text. However, the json-loader's use of
JSON.stringify(value, undefined, "\t")
is causing this matrix to now consume approximately 262144 lines of text. This seems to be causing webpack to take longer then necessary.When running a webpack watch using the json-loader as is, it would take each recompile of my project approximately 6 seconds. When replacing the usage of
JSON.stringify(value, undefined, "\t")
withsource
orJSON.stringify(value)
, this is reduced to approximately 1 second.Perhaps the usage of
"\t"
could be configured via a query option?The text was updated successfully, but these errors were encountered: