←back to thread

260 points gherkinnn | 1 comments | | HN request time: 0s | source
Show context
mh-cx ◴[] No.42164537[source]
I wonder why the article doesn't mention utilizing the browser cache for your static CSS and JS assets instead of introducing a service worker as first measure.

Few years ago I built a shopping site MPA this way and the page transitions were almost not noticable.

replies(7): >>42164573 #>>42164584 #>>42164743 #>>42168597 #>>42169927 #>>42170948 #>>42173755 #
1. youngtaff ◴[] No.42170948[source]
On a session basis browser caches are effective but on a session to session basis it’s likely the content will get evicted as resources from other sites gets cached - there’s an oldish Facebook study where they placed an image in the cache and after 12hrs it had been evicted for 50% of visitors

Service Workers offer more controls over cache lifetime, and in Chromium (at least) JS gets stored in an intermediate form (which reduces the re-compile overhead on reuse)