News for hackers. Stuff that matters.
Re:The Baseline Costs of JavaScript Frameworks by hn_throwaway_99 on Wednesday November 28, 2018 @11:34AM (#18552896)
The main conclusion from this article isn't accurate. This is one reason to load common libraries from a known CDN so that if any website has downloaded that library version previously, and the user's cache has not been cleared or expired, the next time that library can just be loaded from cache, even if from a different website.
Re:The Baseline Costs of JavaScript Frameworks by vanadium on Wednesday November 28, 2018 @11:52AM (#18553115)
This assumes that both your and the the subsequent site's use either pulls an evergreen version (bad practice) or the exact same version (not altogether likely). Doing enough front-end performance auditing for potential clients, it's clear the latter case is as varied as can be.

We pulled everything in-house onto our own Cloudfront CDN and saved a bunch of time on DNS/TLS negotiation, as each unique third-party request is extremely expensive over middling 3G, on the order of nearly 1 second apiece according to WebPageTest. Leveraging 'preconnect' with that CDN saved just a bit more time on top of that.

Re:The Baseline Costs of JavaScript Frameworks by nexensis on Wednesday November 28, 2018 @11:42AM (#18552997)
That's fine for jQuery, Bootstrap etc, however most modern frameworks are bundled into a single package with all of the templates and logic, making a shared CDN useless.

It would be interesting to see some benchmarks of a cached CDN Angular file and non-cached template/logic file, however lots of other sites would have to jump on board to get the cached file into users' browsers reliably.

Re:The Baseline Costs of JavaScript Frameworks by robin_reala on Wednesday November 28, 2018 @11:45AM (#18553035)
Historically that was a major security issue. It’s less of an issue now that SRI exists (you’re using SRI, right?), but it’s still a problem when you have a broken pathway to the CDN but your site loads OK. Well, assuming you’re not building with progressive enhancement. You’re building with progressive enhancement right?
Re:The Baseline Costs of JavaScript Frameworks by hleszek on Wednesday November 28, 2018 @12:11PM (#18553288)
sorry what is SRI ?
Re:The Baseline Costs of JavaScript Frameworks by robin_reala on Wednesday November 28, 2018 @12:34PM (#18553520)
Subresource Integrity. It’s designed specifically for this scenario: a resource included into your page from a seperate server that could potentially be compromised. Your hash the known good resource and include that hash in your script or link tags as an integrity attribute. When the user’s browser downloads the resource it’ll hash it again and check for a match. Only if the two match will it parse and execute the contents.

https://developer.mozilla.org/en-US/docs/Web/Security/Subres...

Re:The Baseline Costs of JavaScript Frameworks by brlewis on Wednesday November 28, 2018 @04:44PM (#18555959)
Don't ignore the time required to parse and execute JS. You don't get as much benefit from cached scripts as you do from other cached resources.