Hacker News new | ask | show | jobs
by leepowers 2981 days ago
This is why you self-host all project dependencies.
1 comments

But that costs you cache hits, increases the real world size of your site, and slows loading. I'm sure mobile users with metered internet would prefer you didn't download that 100 KB JavaScript library for the nth time.
It's more complex than that. Mobile networks are mostly hampered by latency - each additional HTTP request to a different domain requires another TCP coldstart and handshake, DNS lookup, TLS setup, etc.

Many times the 100KB of JavaScript is faster to load when minified and combined with other site code and served compressed over a single HTTP request or streamed via HTTP/2. It's almost always faster to use an existing connection than to start a new one.

Also there isn't one canonical version of jQuery. There's dozens of potential versions available[1]. So it's not immediately clear that a user will have the version a site depends on.

[1] https://mathiasbynens.be/demo/jquery-size

It isn't faster than not re-requesting the resource at all because it was previously downloaded from the CDN which is what the discussion is about.
Does it really?