I've been micro-optimising the performance of https://jakearchibald.github.io/svgomg/
- since the ServiceWorker makes it more likely to have a full cache, I've been looking at time-to-first-render in the full-cache case.
Because the CSS and scripts were cached, they were arriving before first render, that meant the browser was executing/layouting/rendering their results before first render.
The answer? requestAnimationFrame. I was already loading the CSS via JS, but now I'm loading the additional scripts that way too, wrapped in requestAnimationFrame https://github.com/jakearchibald/svgomg/blob/e3dd1ed876ff066bad90a90b63bd319d08e76858/src/index.html#L213
Page-received to first-render on a Nexus 5 went from 700ms to 160ms.