Massive performance improvement by using sync requires in NodeJS
See original GitHub issueHi everyone,
I’ve seen a pretty big performance improvement by using sync requires in NodeJS. I just tweaked the loadOption
function:
if (opts.isNode) {
// import('aaa') => require('aaa')
argPath.parent.callee.type = 'Identifier'
argPath.parent.callee.name = 'require'
}
else {
// import('aaa') => import(/* webpackChunkName: 'aaa-123' */ 'aaa')
argPath.addComment('leading', ` webpackChunkName: '${chunkName}' `)
otherValidMagicComments.forEach(validLeadingComment =>
argPath.addComment('leading', validLeadingComment.value)
)
}
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?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Performance Optimization tips for Node.js Applications
This article covers performance optimization techniques, tools, and tips to make high-performing Node.js apps.
Read more >6 Tips and Techniques to Speed Up and Improve Your Node ...
6 Tips and Techniques to Speed Up and Improve Your Node.js Performance · 1. Caching Your App with Redis · 2. Make sure...
Read more >How to Optimize Your Node.js API - freeCodeCamp
In this article, I will walk you through some of the best methods to optimize APIs written in Node.js. Prerequisites.
Read more >This is why your Node.js application is slow
The simple problem with it is that it is capable of slowing down your application greatly when not correctly used. Whenever a promise...
Read more >Moving 100.000+ files in Node.js sync / async performance ...
The test cases showed, that synchronous renameSync() is slower at 20% then asynchronous rename() . In the same time asynchronous rename() using ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.