Reduce HTTP requests or not?

前端 未结 7 1986
野性不改
野性不改 2021-02-01 05:57

A theoretical question:
We all know about the pro\'s of minifying and combining javascript files in order to reduce HTTP requests to speed up a website. But when popular jav

7条回答
  •  粉色の甜心
    2021-02-01 06:35

    • "Combine and minify each script into a massive one and serve it from my own CDN"

      If you have a CDN, what are we talking about? :) You mean server, right?

    • "How does the big guys in the industry handle it?"

      The big guys always use their own servers.

    • "...it isn't too stupid to assume that these already have been downloaded to the clients computer from another page."

      Unfortunately it is. Facts:

      • 40-60% of users have an empty cache experience
      • browsers' cache limits are small
      • different versions of libraries are in use, cache only happens if they match
      • resource from a new domain creates a DNS lookup, which is slow
      • +you need to manage dependencies

提交回复
热议问题