admin管理员组文章数量:1310325
Given the advantages of connection reuse and multiplexing in HTTP2 (and SPDY) and the availability of gzip pression, is the effort of adding a minification and concatenation step into a build process justified?
Given the advantages of connection reuse and multiplexing in HTTP2 (and SPDY) and the availability of gzip pression, is the effort of adding a minification and concatenation step into a build process justified?
Share Improve this question asked Jan 30, 2014 at 9:12 EuanEuan 4192 silver badges12 bronze badges 03 Answers
Reset to default 5According to Surma from the Chrome team, on H2 you can and in fact should stop bundling because it's useless and to allow more efficient browser caching:
https://www.youtube./watch?v=w--PU4HO9SM (time 1:10)
I think that minifying or obfuscating can still be desirable, depending on your needs.
Testing is the only true means of deciding to minify and/or concatenate when resources are being served via H2/SPDY.
The idea behind HTTP/2 (H2) is to serve small static resources on the stream (a single multiplexing TCP connection). Tests have shown that "most" sites benefit an increase of speed by not concatenating resources (and even not using a CDN). It all depends on the sizes of the resources being served on H2/SPDY. I have seen one site increase speed by 30%+ and others w/o change.
With that inmind, my suggestion is too test by minifing all resources and not concatenating them. I'd also test serving all mon resources (not using a CDN - and that as well depends where your clients are).
Resources:
- Akamai
- Columnist Patrick Stox
- HTTP/2 101 (Chrome Dev Summit 2015)
Yes you still need to minify and concatenate js and css files for the following reasons:
script minifying and SPDY pression are not the same. a good minifier knows to take advantage of local scope and replace verbose variable names with short repetitive names that are pression-friendly.
SPDY bines your requests so you don't have to stitch the scripts together. but not all browsers support SPDY
SPDY 2 and 3 are binary inpatible. When a browser supports 2 and the server advertises 3, the connection falls back to HTTP 1.1 over SSL; there's no SPDY benefits at all
loading 10 files through one request still incurs 10 fetches on the server side. bining the files reduces disk I/O.
Your question is parable to "can I care less about writing efficient code now that the machine can run faster?"
The answer is NO. Don't be lazy. Code properly.
本文标签: Should I minify and concatenate javascript and CSS when using HTTP2SPDYStack Overflow
版权声明:本文标题:Should I minify and concatenate javascript and CSS when using HTTP2SPDY? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741794034a2397829.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论