sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7k stars 434 forks source link

Greedy service worker steals bandwidth from initial load #934

Open arggh opened 4 years ago

arggh commented 4 years ago

I bumped into a weird bug in Lighthouse, where your site's perf score takes a hit when using the "Applied slowdown", especially, it seems, if your site has a lot static assets.

While debugging this, I noticed, that if I delay populating the cache (10 seconds, for example) upon service worker install, I get 20 extra points to my Lighthouse perf score. The exact same improvement was observed if I just removed the service worker altogether.

Maybe it's only an issue when HTTP2 is not available, or maybe it's just an issue when this bug in Lighthouse is part of the scenario, but this got me wondering, if it's such a good default to aggressively cache everything as soon as possible?

I'm still not comfortable enough with service workers to have an opinion on the matter, but I thought I'd put this here for someone to close or comment.

NOtherDev commented 4 years ago

Probably fixable by #970.