Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upWebpack is slow to start and always performs work, even if it is unnecessary #5032
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
marcintustin
commented
Jun 8, 2017
|
Why not add this as a flag in a PR? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
TheLarkInn
Jun 8, 2017
Member
This is although a little jabby
|
This is although a little jabby |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
TheLarkInn
Jun 8, 2017
Member
But then again we consciously purge the inputFileSystem cache for non watching builds. Something to consider: if you are using unique hashing and constantly writing this to in memory fs cache, your cache will continue to grow. Make although a shining example of a primitive fast task runner does maybe 1/100 of the operational logic that webpack is performing. Cases we might need to be aware of that would need to invalidate cache:
- almost any change to the configuration could allow for discovery of new entries files etc, we could no use the lstat or mtimes of previous build in this case.
- hashing of any kind (unless maybe permissable from the user) would cause our mem fs cache to continue to grow
- loader caching: the operation of one instance of a loader is likely comparable to a task in make is performing, with this in mind, we have already created a loader that will help users cache expensive loader operations.
I'm sure the list goes on. Regardless we are always looking for individuals to help performance tune all of the facets of our ecosystem so if you are interested in doing a more comparable, and far less hyperbolic analysis, then we are more than willing to lend a helping hand guiding you through the architecture
|
But then again we consciously purge the inputFileSystem cache for non watching builds. Something to consider: if you are using unique hashing and constantly writing this to in memory fs cache, your cache will continue to grow. Make although a shining example of a primitive fast task runner does maybe 1/100 of the operational logic that webpack is performing. Cases we might need to be aware of that would need to invalidate cache:
I'm sure the list goes on. Regardless we are always looking for individuals to help performance tune all of the facets of our ecosystem so if you are interested in doing a more comparable, and far less hyperbolic analysis, then we are more than willing to lend a helping hand guiding you through the architecture |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Munter
Jun 8, 2017
Make has its dependency graph defined in the makefile itself, which is what allows it to reason about work needing to be done. Webpack does not have this. It has entry points and must walk the dependency graph to it's full extent before it can start reasoning about the current state and compare to the previous one. These are radically different approaches, which will always have webpack come out slower. But I invite you to roll out your dependency graph into a flat make file yourself and see if you come up with a faster, useful and maintainable tool kit. Having worked for years in similar tooling I doubt the results will compete with make.
As for comparing start up time of a native binary with a script that depends on an entire node runtime to boot up, this feels out of scope for webpack specifically. You might want to open that part of the issue in the node project
Munter
commented
Jun 8, 2017
|
Make has its dependency graph defined in the makefile itself, which is what allows it to reason about work needing to be done. Webpack does not have this. It has entry points and must walk the dependency graph to it's full extent before it can start reasoning about the current state and compare to the previous one. These are radically different approaches, which will always have webpack come out slower. But I invite you to roll out your dependency graph into a flat make file yourself and see if you come up with a faster, useful and maintainable tool kit. Having worked for years in similar tooling I doubt the results will compete with make. As for comparing start up time of a native binary with a script that depends on an entire node runtime to boot up, this feels out of scope for webpack specifically. You might want to open that part of the issue in the node project |
kevinburke commentedJun 8, 2017
•
edited
Edited 1 time
-
kevinburke
edited Jun 8, 2017 (most recent)
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If the
--watchmode is not specified, Webpack always runs the function in the config file on the inputs, to produce the output.If the current behavior is a bug, please provide the steps to reproduce.
webpack --config /path/to/config.json, to write the output file as a function of the inputs.webpackagain with the same commands.What is the expected behavior?
The second time
webpackis invoked, I expect it to detect that the mtimes of the inputs are all older than the mtimes of the output file, print that there is no work to be done, and exit with a 0 return code.If this is a feature request, what is motivation or use case for changing the behavior?
Make is a build automation tool released for UNIX systems in April 1976, 41 years ago. If I define a Make target as follows:
and invoke it with:
Make will check the mtimes of
static/one.js,static/two.js, andoutput.js(which you can check by using the Lstat syscall on the affected files). If the mtime for output.js is newer than its inputs, make outputs the following:And exits with a 0 return code. This means it is faster - make does not do unnecessary work - and more composable. It is always easy to invoke
make output.jsas part of another build script, since make will exit early if there is no work to be done.By contrast, webpack does all of the work every single time. This makes it more difficult to compose as part of a larger build process, since invoking webpack means the work is always performed even if there is no point in doing the work since the inputs haven't changed since the output file was written.
In addition to doing unnecessary work, webpack has a slower startup time than
make. Here is the amount of time it takesmaketo print the version string:Or 26 milliseconds. It takes
webpack, released 36 years later, about 8 times as long to print the version string:This is a significant performance regression, both in startup time and in the amount of work that is performed. It's especially confusing given the modest improvements in CPU performance, and the increases in available RAM, in the years between 1976 and 2012.
It would be nice if performance improved along one or both of these axes.