5 ms·
What was wrong again with runtime CSS? By the smell of it seems to be performance, so: can somebody point to performance comparisons, or give a brief of the adv
by pestatije 6y ago
What was wrong again with runtime CSS? By the smell of it seems to be performance, so: can somebody point to performance comparisons, or give a brief of the advantages?
- mStreamTeam 6y agoThere's nothing wrong with runtime CSS. Frontend devs just like to come up with elaborate solutions to problems that don't exist
- simonmales 6y agoFrom my understanding of frontend performance, JS parsing is blocking. So reducing the JS "load" is a performance win on the client.
- jitl 6y agoIt’s all about time to interactive. For a big complex app (eg, https://www.notion.so https://www.notion.so which I work on), a significant fraction of JS code size is spent describing styles. There can also be JS cycles spent doing color math like lighten, darken, hue shifting on base colors, etc. With runtime CSS-in-JS, all of that style JS code must be parsed and executed by the JS runtime on every page load by every user. That’s a lot of CPU time and user wait time multiplied out. Zero-runtime improves page load performance by moving this extra code from the JS vm to static CSS files. The majority of style computation happens at build time. The CSS can then be downloaded and parsed in parallel with the JS (woo threads?). The separation may improve caching compared to all-JS solution as well, depending on how granular the CSS and JS output files are.