Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s been awhile since I’ve worked in the frontend space, but even 5 or 6 years ago if you were using a pretty popular hosted CDN of JQuery with a pretty recent version there was a pretty good chance it was already cached on the end user’s device when they hit your site. There’s always a lot of talk about Jquery’s size but I wonder how many users don’t even notice because they’ve already got it on their system.

There’s also of course the added cost of executing the library on the site but I’m guessing V8 and other JS engines have optimized the hell out of that too as to make it pretty negligible in terms of time difference.



Modern browsers partition caches by site nowadays - at least, Chrome started doing it last year[0], and Firefox followed soon after I think [1]. That means there's no longer any caching benefit for multiple websites using jQuery - each site will download and cache it separately.

[0] https://developers.google.com/web/updates/2020/10/http-cache...

[1] https://developer.mozilla.org/en-US/docs/Web/Privacy/State_P...


Interesting. Reading Mozilla’s justification it does make a lot of sense, however it is kind of unfortunate to lose something that was pretty beneficial in terms of performance because of some bad actors. It’s not really viable to maintain a whitelist of trusted libraries either, and doing so would create a whole new class of problems.

Ideally CDN’s are powerful and ubiquitous enough these days that at least when you have the end user going and asking for JQuery from Cloudflare or whoever the CDN probably has a very fast location right next to them distance wise and that data should get over the wire pretty dang quickly. It’s still another performance hit though since you know at least the first time on the site they have to go and get it and if you are hosting your own stuff it might make more sense to just webpack everything together and hand it off to the CDN instead of having something like JQuery be on its own. Less overhead for opening another network request and all that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: