开发者

What is the recommended JS kb limit for a web app? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editi开发者_如何学Cng this post.

Closed 5 years ago.

Improve this question

Just wondering if anyone more experienced out there could suggest a recommended limit for total JS resources in a web app. I want to make sure I'm not overloading my bandwidth.

I'm currently around 350 - 400kb spread between two .js files (unminified). This is not including jQuery & jQuery UI from Google CDN.

Thanks!


I suppose there isn't really a recommended "file size" per-say.

More a recommended length of time for your entire page to load, including all css, images, javascript, rendering time etc. Too long and people are going to loose interest, but it really depends on your content i.e. if it's very specific content that people are after, then they will wait for longer, but if your running an e-commerce site and your competition is only a click away, then page-load times are very important.

I suppose the answer is make your files as small as possible and your site load as fast as possible. But this is going to be a classic return on investment question, if your running an e-commerce site, a faster loading site could lead to more sales?

But to try and answer your question, 400KB seems a little heavy to me. As a general rule of thumb, you want to aim for sub 10 second for a sub 2 second load time of the page beginning to be visible - to at least give a response to your user.

Here are Yahoo's Best Practices for Speeding Up Your Web Site

You can also run Y-Slow a firebug add-on, or numerous other speed tests to analyse and give recommendations.

Google's Page Speed site is a more contemporary approach to page speed.


I believe it's around 500kb, at which point you start taking serious performance hits.


It is not clear if you are looking for page rendering performance or cost for your hosting advise...

For both: all your static files (CSS, JS, images) should be minified and served compressed (in case of images make sure you choose smallest acceptable size) if you are expecting site to be high traffic. Setting correct caching headers is important too.

Page rendering - see Alex Key's answer.

Cost of hosting - you are the one to figure out what is acceptatble. It is relatively easy to estimate - number of users per period of time multiplied by average download size from your site wil give you the number. You can also consider putting static content on some CDN.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜