Skip to content
This repository was archived by the owner on Aug 20, 2018. It is now read-only.
This repository was archived by the owner on Aug 20, 2018. It is now read-only.

Usage of "\t" in JSON.stringify makes webpack needlessly slow #31

Closed
@thejonwithnoh

Description

@thejonwithnoh

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 as source 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") with source or JSON.stringify(value), this is reduced to approximately 1 second.

Perhaps the usage of "\t" could be configured via a query option?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions