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

Hmm. Usually browsers cache the raw CSS and JS assets - could that be improved so that browsers cache the compiled CSS/JS? That wouldn't help for the first load, of course - but quite a lot for sites like newspapers which are not SPAs but bundle a metric ton of JS cr.p for each page load.

edit: Chrome actually does that, as mentioned in the article - but what about Chrome Mobile and Firefox/Safari/IE?



From the article:

"Chrome 42 introduced code caching — a way to store a local copy of compiled code so that when users returned to the page, steps like script fetching, parsing and compilation could all be skipped. At the time we noted that this change allowed Chrome to avoid about 40% of compilation time on future visits, but I want to provide a little more insight into this feature:

1. Code caching triggers for scripts that are executed twice in 72 hours.

2. For scripts of Service Worker: Code caching triggers for scripts that are executed twice in 72 hours.

3. For scripts stored in Cache Storage via Service Worker: Code caching triggers for scripts in the first execution.

So, yes. If our code is subject to caching V8 will skip parsing and compiling on the third load."


Soemthing I've wanted for a long while is the ability to warm the codegen cache. It should be possible to instruct the browser to load and parse JavaScript so that on subsequent page loads execution can begin immediately. This would work really well with the model that Sevice Workers are moving towards.


Firefox is adding something similar. See https://bugzilla.mozilla.org/show_bug.cgi?id=900784




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

Search: