Large libraries: use common CDNs or purge unused code? #518
-
It seems large libraries are penalized for long download times on slow networks. The recommendation is to remove unused CSS/JS. Is it better to assume users have downloaded and cached common CDN-hosted files, or does lighthouse always show the worst-case scenario with no cache? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In practice this is not an assumption that is true. In fact, browsers by now are moving to a double-keyed cache where no CDN assets are shared between sites at all, even if the user had the unlikely exact combination of library versions from the same CDN as another recently visited site. Also worth noting a significant portion of the cost isn't just downloading a large JS library, but in parsing and initial evaluation as well which does not receive the same benefits of the network disk cache.
It shows the no cache performance by default. |
Beta Was this translation helpful? Give feedback.
In practice this is not an assumption that is true. In fact, browsers by now are moving to a double-keyed cache where no CDN assets are shared between sites at all, even if the user had the unlikely exact combination of library versions from the same CDN as another recently visited site.
Also worth noting a significant portion of the cost isn't just downloading a large JS library, but in parsing and initial evaluation as well which does not receive the same benefits of the network disk cache.
It shows the no cache performance by default.
--…