admin管理员组文章数量:1389924
Let's say that the final bundle produced by webpack
is around ~15MB.
Besides slow loading for the first time on the site, are there any significant performance issues paring to let's say 500KB bundle? (that has been uglified, or used .min npm packages)
Let's say that the final bundle produced by webpack
is around ~15MB.
Besides slow loading for the first time on the site, are there any significant performance issues paring to let's say 500KB bundle? (that has been uglified, or used .min npm packages)
-
1
You can use Dev Tools in the browser to analyze performance, it will tell you how much impact is your javascript doing. Open Dev Tools, go to Performance and
Start profiling and reload the page
. You'll have a report and theScripting
legend is the time consumed by your scripts on load. – arieljuod Commented Dec 12, 2020 at 14:15 - 15 mb is too much. You should use async importing on webpack that will reduce your bundle size. – Gurkan Ugurlu Commented Dec 12, 2020 at 14:21
2 Answers
Reset to default 5Performance implications include:
- Time to transmit over the network. Especially consider slow connections with some mobile devices. Depending on what you're doing it's possible your page will not be interactive until it loads.
- JS parse time. Modern JS engines are fast, but the more code you load the more the browser must parse through.
- JS execution time. Optimally you'd only pack code you expect to execute. The more code you want to execute the longer it will take. Again it's possible your page won't be interactive until much of this pletes, depending on the details.
- Memory consumption. Everything takes up space: the code itself, runtime variables, DOM elements created, etc.
It's important to use the developer tools of your favorite browser to analyze the impact of your code. Be sure to remove any JS your site doesn't really need.
JavaScript is parsed, piled and executed in the main thread of the browser, which means the users have to wait for all this before they can interact with the website.
15MB is a lot of JS code.
There are tools for profiling the performance built in into the major web browsers, which you can check out.
You can learn more about this here: https://web.dev/bootup-time/.
本文标签: javascriptHow does bundle size affects performanceStack Overflow
版权声明:本文标题:javascript - How does bundle size affects performance? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744653014a2617798.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论