Hacker News new | ask | show | jobs
by jitl 1994 days ago
It’s all about time to interactive.

For a big complex app (eg, 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.

1 comments

Oh!, now I get it: CSS static was not good, so welcome JS generated CSS.

But that was not good either, so welcome buildtime JS generated CSS.

Brilliant!

Yes, best of both worlds