-
Notifications
You must be signed in to change notification settings - Fork 41
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
Massive performance improvement by using sync requires in NodeJS #74
Comments
Can you explain the perf improvement you're seeing? Is this with regards to build time? An import statement and a require statement are more or less equivalent as webpack transforms it to it's own webpack import statement AFAIK. |
@konpikwastaken yes, build time. We have a pretty large app with thousands of modules that went from 10s to 2s rebuild time in dev, for example. Whenever Webpack sees an import statement, it'll split from that point on. It doesn't seem like it's the splitting part that is slow, but rather the joining of modules by LimitChunksPlugin |
Yeah, I get it - I just looked through the LimitWebpackChunksPlugin code as well, so I see what you're saying. On building server bundles though, I thought that I can try this out on some projects tomorrow and see if it works as expected - we have some projects using wonky setups with SSR, flushing used chunks, and some crazy webpack path aliasing. /edit: I mean I think |
Check out the RFR demo or universal ones if you have any issues. |
Slowness tho, that’s been problematic server build kills. |
@ScriptedAlchemy our setup was already working great, but development build times were not. I indeed followed the RFR demo since the beginning, but it is a very small application that doesn't represent real-world scenarios; it works, it's fast, but it won't be as fast once it expands to thousands of modules and 100+ chunks. I just did a quick test with 500 extra modules and build time was decreased from 37s to 16s when I disabled LimitChunkCountPlugin. It gets worse and worse the more modules are added. |
I hear you! We all suffer from it. I might just fork the plugin and use more efficient mapping like fast-transducers It’s sucks but it’s kind of out of our hands unless we take the hit and try to repair the crap. I hate the plugin. Haaaaaate |
what you can do, is just disable ssr builds in development. What I’ve been doing do one build and turn off HMR on the server |
Can someone PR the README with an example webpack configuration. This would be so helpful and valuable |
I believe that the suggested change will break chunk names flushing, and that adding an example in the README isn't a good idea since it's the RUC responsibility to provide it and having multiple examples in different repositories will make it hard to maintain. Or maybe add a link to Universal Demo. |
Hi everyone,
I've seen a pretty big performance improvement by using sync requires in NodeJS. I just tweaked the
loadOption
function:It seems like generating multiple chunks, and then using LimitChunksWebpackPlugin to merge them all together for SSR is slow. Does my change make sense? Could it break stuff?
The text was updated successfully, but these errors were encountered: