@tenphi/tasty 0.0.0-snapshot.bbd10c7 → 0.0.0-snapshot.bbfcd75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/README.md +196 -140
  2. package/dist/babel-Zs1Q03qt.d.ts +83 -0
  3. package/dist/chunks/async-storage-CG5HnUT5.js +20 -0
  4. package/dist/chunks/async-storage-CG5HnUT5.js.map +1 -0
  5. package/dist/chunks/build-config-CUQVwdWF.js +42 -0
  6. package/dist/chunks/build-config-CUQVwdWF.js.map +1 -0
  7. package/dist/chunks/collector-B0LTHw6Z.js +208 -0
  8. package/dist/chunks/collector-B0LTHw6Z.js.map +1 -0
  9. package/dist/chunks/config-engine-C3pF9EK9.js +267 -0
  10. package/dist/chunks/config-engine-C3pF9EK9.js.map +1 -0
  11. package/dist/chunks/css-definitions-D_it4XZH.js +875 -0
  12. package/dist/chunks/css-definitions-D_it4XZH.js.map +1 -0
  13. package/dist/chunks/css-resources-BN8apgxt.js +142 -0
  14. package/dist/chunks/css-resources-BN8apgxt.js.map +1 -0
  15. package/dist/{debug.js → chunks/debug-C9LeNVoJ.js} +187 -139
  16. package/dist/chunks/debug-C9LeNVoJ.js.map +1 -0
  17. package/dist/chunks/dsl-C5yuAn41.js +1373 -0
  18. package/dist/chunks/dsl-C5yuAn41.js.map +1 -0
  19. package/dist/chunks/hydration-TRcz5vnk.js +41 -0
  20. package/dist/chunks/hydration-TRcz5vnk.js.map +1 -0
  21. package/dist/chunks/react-runtime-O-OUrKLH.js +557 -0
  22. package/dist/chunks/react-runtime-O-OUrKLH.js.map +1 -0
  23. package/dist/chunks/runtime-engine-DvnE2g-E.js +2437 -0
  24. package/dist/chunks/runtime-engine-DvnE2g-E.js.map +1 -0
  25. package/dist/chunks/runtime-state-BTDqSYBk.js +127 -0
  26. package/dist/chunks/runtime-state-BTDqSYBk.js.map +1 -0
  27. package/dist/{utils/merge-styles.js → chunks/shared-utils-DWA4LjIa.js} +55 -55
  28. package/dist/chunks/shared-utils-DWA4LjIa.js.map +1 -0
  29. package/dist/chunks/style-engine-C1ECBZxR.js +5131 -0
  30. package/dist/chunks/style-engine-C1ECBZxR.js.map +1 -0
  31. package/dist/{zero/extractor.js → chunks/zero-engine-B6EnYcXY.js} +89 -82
  32. package/dist/chunks/zero-engine-B6EnYcXY.js.map +1 -0
  33. package/dist/collector-hl5KNH7k.d.ts +165 -0
  34. package/dist/config-DWL1ZYue.d.ts +1358 -0
  35. package/dist/core/index.d.ts +5 -34
  36. package/dist/core/index.js +9 -27
  37. package/dist/index-D9N9GV24.d.ts +1947 -0
  38. package/dist/index.d.ts +5 -51
  39. package/dist/index.js +11 -36
  40. package/dist/{utils/merge-styles.d.ts → merge-styles-C_oMoJVd.d.ts} +3 -3
  41. package/dist/ssr/astro-client.js +6 -0
  42. package/dist/ssr/astro-client.js.map +1 -0
  43. package/dist/ssr/astro-middleware-extract-static.d.ts +11 -0
  44. package/dist/ssr/astro-middleware-extract-static.js +9 -0
  45. package/dist/ssr/astro-middleware-extract-static.js.map +1 -0
  46. package/dist/ssr/astro-middleware-extract.d.ts +11 -0
  47. package/dist/ssr/astro-middleware-extract.js +9 -0
  48. package/dist/ssr/astro-middleware-extract.js.map +1 -0
  49. package/dist/ssr/astro-middleware-static.d.ts +18 -0
  50. package/dist/ssr/astro-middleware-static.js +7 -0
  51. package/dist/ssr/astro-middleware-static.js.map +1 -0
  52. package/dist/ssr/astro-middleware.d.ts +19 -0
  53. package/dist/ssr/astro-middleware.js +7 -0
  54. package/dist/ssr/astro-middleware.js.map +1 -0
  55. package/dist/ssr/astro.d.ts +117 -11
  56. package/dist/ssr/astro.js +204 -48
  57. package/dist/ssr/astro.js.map +1 -1
  58. package/dist/ssr/index.d.ts +37 -4
  59. package/dist/ssr/index.js +6 -6
  60. package/dist/ssr/index.js.map +1 -1
  61. package/dist/ssr/next-config.d.ts +66 -0
  62. package/dist/ssr/next-config.js +124 -0
  63. package/dist/ssr/next-config.js.map +1 -0
  64. package/dist/ssr/next.d.ts +14 -5
  65. package/dist/ssr/next.js +31 -46
  66. package/dist/ssr/next.js.map +1 -1
  67. package/dist/static/index.d.ts +91 -5
  68. package/dist/static/index.js +31 -3
  69. package/dist/static/index.js.map +1 -0
  70. package/dist/static/inject.js.map +1 -1
  71. package/dist/types-jKZNpias.d.ts +1616 -0
  72. package/dist/zero/babel.d.ts +2 -182
  73. package/dist/zero/babel.js +82 -113
  74. package/dist/zero/babel.js.map +1 -1
  75. package/dist/zero/index.d.ts +81 -3
  76. package/dist/zero/index.js +2 -3
  77. package/dist/zero/next.d.ts +1 -1
  78. package/dist/zero/next.js +0 -31
  79. package/dist/zero/next.js.map +1 -1
  80. package/docs/README.md +20 -12
  81. package/docs/adoption.md +59 -32
  82. package/docs/ai-agents.md +229 -0
  83. package/docs/comparison.md +76 -48
  84. package/docs/configuration.md +566 -69
  85. package/docs/debug.md +37 -23
  86. package/docs/design-system.md +63 -32
  87. package/docs/dsl.md +527 -179
  88. package/docs/getting-started.md +62 -41
  89. package/docs/injector.md +157 -51
  90. package/docs/methodology.md +69 -37
  91. package/docs/migration-v3.md +285 -0
  92. package/docs/pipeline.md +744 -0
  93. package/docs/plugins.md +353 -0
  94. package/docs/{runtime.md → react-api.md} +176 -67
  95. package/docs/runtime-benchmarks.md +377 -0
  96. package/docs/ssr.md +350 -94
  97. package/docs/styles.md +108 -27
  98. package/docs/tasty-static.md +149 -87
  99. package/package.json +121 -23
  100. package/tasty.config.ts +6 -0
  101. package/dist/_virtual/_rolldown/runtime.js +0 -7
  102. package/dist/chunks/cacheKey.js +0 -77
  103. package/dist/chunks/cacheKey.js.map +0 -1
  104. package/dist/chunks/definitions.d.ts +0 -37
  105. package/dist/chunks/definitions.js +0 -258
  106. package/dist/chunks/definitions.js.map +0 -1
  107. package/dist/chunks/index.d.ts +0 -1
  108. package/dist/chunks/renderChunk.d.ts +0 -1
  109. package/dist/chunks/renderChunk.js +0 -59
  110. package/dist/chunks/renderChunk.js.map +0 -1
  111. package/dist/compute-styles.d.ts +0 -31
  112. package/dist/compute-styles.js +0 -356
  113. package/dist/compute-styles.js.map +0 -1
  114. package/dist/config.d.ts +0 -372
  115. package/dist/config.js +0 -507
  116. package/dist/config.js.map +0 -1
  117. package/dist/counter-style/index.js +0 -51
  118. package/dist/counter-style/index.js.map +0 -1
  119. package/dist/debug.d.ts +0 -89
  120. package/dist/debug.js.map +0 -1
  121. package/dist/font-face/index.js +0 -63
  122. package/dist/font-face/index.js.map +0 -1
  123. package/dist/hooks/index.d.ts +0 -7
  124. package/dist/hooks/useCounterStyle.d.ts +0 -50
  125. package/dist/hooks/useCounterStyle.js +0 -45
  126. package/dist/hooks/useCounterStyle.js.map +0 -1
  127. package/dist/hooks/useFontFace.d.ts +0 -43
  128. package/dist/hooks/useFontFace.js +0 -69
  129. package/dist/hooks/useFontFace.js.map +0 -1
  130. package/dist/hooks/useGlobalStyles.d.ts +0 -30
  131. package/dist/hooks/useGlobalStyles.js +0 -77
  132. package/dist/hooks/useGlobalStyles.js.map +0 -1
  133. package/dist/hooks/useKeyframes.d.ts +0 -56
  134. package/dist/hooks/useKeyframes.js +0 -63
  135. package/dist/hooks/useKeyframes.js.map +0 -1
  136. package/dist/hooks/useProperty.d.ts +0 -79
  137. package/dist/hooks/useProperty.js +0 -108
  138. package/dist/hooks/useProperty.js.map +0 -1
  139. package/dist/hooks/useRawCSS.d.ts +0 -53
  140. package/dist/hooks/useRawCSS.js +0 -34
  141. package/dist/hooks/useRawCSS.js.map +0 -1
  142. package/dist/hooks/useStyles.d.ts +0 -40
  143. package/dist/hooks/useStyles.js +0 -29
  144. package/dist/hooks/useStyles.js.map +0 -1
  145. package/dist/injector/index.d.ts +0 -166
  146. package/dist/injector/index.js +0 -166
  147. package/dist/injector/index.js.map +0 -1
  148. package/dist/injector/injector.d.ts +0 -166
  149. package/dist/injector/injector.js +0 -464
  150. package/dist/injector/injector.js.map +0 -1
  151. package/dist/injector/sheet-manager.d.ts +0 -136
  152. package/dist/injector/sheet-manager.js +0 -733
  153. package/dist/injector/sheet-manager.js.map +0 -1
  154. package/dist/injector/types.d.ts +0 -204
  155. package/dist/keyframes/index.js +0 -206
  156. package/dist/keyframes/index.js.map +0 -1
  157. package/dist/parser/classify.js +0 -319
  158. package/dist/parser/classify.js.map +0 -1
  159. package/dist/parser/const.js +0 -60
  160. package/dist/parser/const.js.map +0 -1
  161. package/dist/parser/lru.js +0 -109
  162. package/dist/parser/lru.js.map +0 -1
  163. package/dist/parser/parser.d.ts +0 -25
  164. package/dist/parser/parser.js +0 -115
  165. package/dist/parser/parser.js.map +0 -1
  166. package/dist/parser/tokenizer.js +0 -69
  167. package/dist/parser/tokenizer.js.map +0 -1
  168. package/dist/parser/types.d.ts +0 -51
  169. package/dist/parser/types.js +0 -46
  170. package/dist/parser/types.js.map +0 -1
  171. package/dist/pipeline/conditions.d.ts +0 -134
  172. package/dist/pipeline/conditions.js +0 -406
  173. package/dist/pipeline/conditions.js.map +0 -1
  174. package/dist/pipeline/exclusive.js +0 -230
  175. package/dist/pipeline/exclusive.js.map +0 -1
  176. package/dist/pipeline/index.d.ts +0 -55
  177. package/dist/pipeline/index.js +0 -708
  178. package/dist/pipeline/index.js.map +0 -1
  179. package/dist/pipeline/materialize.js +0 -1103
  180. package/dist/pipeline/materialize.js.map +0 -1
  181. package/dist/pipeline/parseStateKey.d.ts +0 -15
  182. package/dist/pipeline/parseStateKey.js +0 -446
  183. package/dist/pipeline/parseStateKey.js.map +0 -1
  184. package/dist/pipeline/simplify.js +0 -515
  185. package/dist/pipeline/simplify.js.map +0 -1
  186. package/dist/pipeline/warnings.js +0 -18
  187. package/dist/pipeline/warnings.js.map +0 -1
  188. package/dist/plugins/index.d.ts +0 -2
  189. package/dist/plugins/okhsl-plugin.d.ts +0 -35
  190. package/dist/plugins/okhsl-plugin.js +0 -97
  191. package/dist/plugins/okhsl-plugin.js.map +0 -1
  192. package/dist/plugins/types.d.ts +0 -76
  193. package/dist/properties/index.js +0 -222
  194. package/dist/properties/index.js.map +0 -1
  195. package/dist/properties/property-type-resolver.d.ts +0 -24
  196. package/dist/properties/property-type-resolver.js +0 -90
  197. package/dist/properties/property-type-resolver.js.map +0 -1
  198. package/dist/ssr/async-storage.d.ts +0 -17
  199. package/dist/ssr/async-storage.js +0 -34
  200. package/dist/ssr/async-storage.js.map +0 -1
  201. package/dist/ssr/collect-auto-properties.js +0 -39
  202. package/dist/ssr/collect-auto-properties.js.map +0 -1
  203. package/dist/ssr/collector.d.ts +0 -102
  204. package/dist/ssr/collector.js +0 -219
  205. package/dist/ssr/collector.js.map +0 -1
  206. package/dist/ssr/format-global-rules.js +0 -22
  207. package/dist/ssr/format-global-rules.js.map +0 -1
  208. package/dist/ssr/format-keyframes.js +0 -69
  209. package/dist/ssr/format-keyframes.js.map +0 -1
  210. package/dist/ssr/format-property.js +0 -49
  211. package/dist/ssr/format-property.js.map +0 -1
  212. package/dist/ssr/format-rules.js +0 -73
  213. package/dist/ssr/format-rules.js.map +0 -1
  214. package/dist/ssr/hydrate.d.ts +0 -22
  215. package/dist/ssr/hydrate.js +0 -49
  216. package/dist/ssr/hydrate.js.map +0 -1
  217. package/dist/ssr/ssr-collector-ref.js +0 -12
  218. package/dist/ssr/ssr-collector-ref.js.map +0 -1
  219. package/dist/states/index.d.ts +0 -49
  220. package/dist/states/index.js +0 -170
  221. package/dist/states/index.js.map +0 -1
  222. package/dist/static/tastyStatic.d.ts +0 -46
  223. package/dist/static/tastyStatic.js +0 -30
  224. package/dist/static/tastyStatic.js.map +0 -1
  225. package/dist/static/types.d.ts +0 -49
  226. package/dist/static/types.js +0 -24
  227. package/dist/static/types.js.map +0 -1
  228. package/dist/styles/border.d.ts +0 -25
  229. package/dist/styles/border.js +0 -120
  230. package/dist/styles/border.js.map +0 -1
  231. package/dist/styles/color.d.ts +0 -14
  232. package/dist/styles/color.js +0 -26
  233. package/dist/styles/color.js.map +0 -1
  234. package/dist/styles/const.js +0 -17
  235. package/dist/styles/const.js.map +0 -1
  236. package/dist/styles/createStyle.js +0 -79
  237. package/dist/styles/createStyle.js.map +0 -1
  238. package/dist/styles/dimension.js +0 -109
  239. package/dist/styles/dimension.js.map +0 -1
  240. package/dist/styles/directional.js +0 -133
  241. package/dist/styles/directional.js.map +0 -1
  242. package/dist/styles/display.d.ts +0 -30
  243. package/dist/styles/display.js +0 -73
  244. package/dist/styles/display.js.map +0 -1
  245. package/dist/styles/fade.d.ts +0 -15
  246. package/dist/styles/fade.js +0 -62
  247. package/dist/styles/fade.js.map +0 -1
  248. package/dist/styles/fill.d.ts +0 -42
  249. package/dist/styles/fill.js +0 -51
  250. package/dist/styles/fill.js.map +0 -1
  251. package/dist/styles/flow.d.ts +0 -16
  252. package/dist/styles/flow.js +0 -12
  253. package/dist/styles/flow.js.map +0 -1
  254. package/dist/styles/gap.d.ts +0 -31
  255. package/dist/styles/gap.js +0 -38
  256. package/dist/styles/gap.js.map +0 -1
  257. package/dist/styles/height.d.ts +0 -17
  258. package/dist/styles/height.js +0 -19
  259. package/dist/styles/height.js.map +0 -1
  260. package/dist/styles/index.d.ts +0 -1
  261. package/dist/styles/index.js +0 -8
  262. package/dist/styles/index.js.map +0 -1
  263. package/dist/styles/inset.d.ts +0 -24
  264. package/dist/styles/inset.js +0 -34
  265. package/dist/styles/inset.js.map +0 -1
  266. package/dist/styles/list.d.ts +0 -16
  267. package/dist/styles/list.js +0 -100
  268. package/dist/styles/list.js.map +0 -1
  269. package/dist/styles/margin.d.ts +0 -24
  270. package/dist/styles/margin.js +0 -32
  271. package/dist/styles/margin.js.map +0 -1
  272. package/dist/styles/outline.d.ts +0 -29
  273. package/dist/styles/outline.js +0 -55
  274. package/dist/styles/outline.js.map +0 -1
  275. package/dist/styles/padding.d.ts +0 -24
  276. package/dist/styles/padding.js +0 -32
  277. package/dist/styles/padding.js.map +0 -1
  278. package/dist/styles/placement.d.ts +0 -37
  279. package/dist/styles/placement.js +0 -74
  280. package/dist/styles/placement.js.map +0 -1
  281. package/dist/styles/predefined.d.ts +0 -71
  282. package/dist/styles/predefined.js +0 -237
  283. package/dist/styles/predefined.js.map +0 -1
  284. package/dist/styles/preset.d.ts +0 -52
  285. package/dist/styles/preset.js +0 -127
  286. package/dist/styles/preset.js.map +0 -1
  287. package/dist/styles/radius.d.ts +0 -12
  288. package/dist/styles/radius.js +0 -83
  289. package/dist/styles/radius.js.map +0 -1
  290. package/dist/styles/scrollMargin.d.ts +0 -24
  291. package/dist/styles/scrollMargin.js +0 -32
  292. package/dist/styles/scrollMargin.js.map +0 -1
  293. package/dist/styles/scrollbar.d.ts +0 -25
  294. package/dist/styles/scrollbar.js +0 -51
  295. package/dist/styles/scrollbar.js.map +0 -1
  296. package/dist/styles/shadow.d.ts +0 -14
  297. package/dist/styles/shadow.js +0 -25
  298. package/dist/styles/shadow.js.map +0 -1
  299. package/dist/styles/shared.js +0 -17
  300. package/dist/styles/shared.js.map +0 -1
  301. package/dist/styles/transition.d.ts +0 -14
  302. package/dist/styles/transition.js +0 -159
  303. package/dist/styles/transition.js.map +0 -1
  304. package/dist/styles/types.d.ts +0 -564
  305. package/dist/styles/width.d.ts +0 -17
  306. package/dist/styles/width.js +0 -19
  307. package/dist/styles/width.js.map +0 -1
  308. package/dist/tasty.d.ts +0 -134
  309. package/dist/tasty.js +0 -240
  310. package/dist/tasty.js.map +0 -1
  311. package/dist/types.d.ts +0 -184
  312. package/dist/utils/cache-wrapper.js +0 -21
  313. package/dist/utils/cache-wrapper.js.map +0 -1
  314. package/dist/utils/case-converter.js +0 -8
  315. package/dist/utils/case-converter.js.map +0 -1
  316. package/dist/utils/color-math.d.ts +0 -46
  317. package/dist/utils/color-math.js +0 -749
  318. package/dist/utils/color-math.js.map +0 -1
  319. package/dist/utils/color-space.d.ts +0 -5
  320. package/dist/utils/color-space.js +0 -228
  321. package/dist/utils/color-space.js.map +0 -1
  322. package/dist/utils/colors.d.ts +0 -5
  323. package/dist/utils/colors.js +0 -10
  324. package/dist/utils/colors.js.map +0 -1
  325. package/dist/utils/css-types.d.ts +0 -7
  326. package/dist/utils/dotize.d.ts +0 -26
  327. package/dist/utils/dotize.js +0 -122
  328. package/dist/utils/dotize.js.map +0 -1
  329. package/dist/utils/filter-base-props.d.ts +0 -15
  330. package/dist/utils/filter-base-props.js +0 -45
  331. package/dist/utils/filter-base-props.js.map +0 -1
  332. package/dist/utils/get-display-name.d.ts +0 -7
  333. package/dist/utils/get-display-name.js +0 -10
  334. package/dist/utils/get-display-name.js.map +0 -1
  335. package/dist/utils/has-keys.js +0 -13
  336. package/dist/utils/has-keys.js.map +0 -1
  337. package/dist/utils/is-dev-env.js +0 -19
  338. package/dist/utils/is-dev-env.js.map +0 -1
  339. package/dist/utils/is-valid-element-type.js +0 -15
  340. package/dist/utils/is-valid-element-type.js.map +0 -1
  341. package/dist/utils/merge-styles.js.map +0 -1
  342. package/dist/utils/mod-attrs.d.ts +0 -6
  343. package/dist/utils/mod-attrs.js +0 -20
  344. package/dist/utils/mod-attrs.js.map +0 -1
  345. package/dist/utils/process-tokens.d.ts +0 -17
  346. package/dist/utils/process-tokens.js +0 -83
  347. package/dist/utils/process-tokens.js.map +0 -1
  348. package/dist/utils/resolve-recipes.d.ts +0 -17
  349. package/dist/utils/resolve-recipes.js +0 -146
  350. package/dist/utils/resolve-recipes.js.map +0 -1
  351. package/dist/utils/selector-transform.js +0 -32
  352. package/dist/utils/selector-transform.js.map +0 -1
  353. package/dist/utils/string.js +0 -8
  354. package/dist/utils/string.js.map +0 -1
  355. package/dist/utils/styles.d.ts +0 -99
  356. package/dist/utils/styles.js +0 -220
  357. package/dist/utils/styles.js.map +0 -1
  358. package/dist/utils/typography.d.ts +0 -47
  359. package/dist/utils/typography.js +0 -51
  360. package/dist/utils/typography.js.map +0 -1
  361. package/dist/utils/warnings.d.ts +0 -16
  362. package/dist/utils/warnings.js +0 -16
  363. package/dist/utils/warnings.js.map +0 -1
  364. package/dist/zero/css-writer.d.ts +0 -45
  365. package/dist/zero/css-writer.js +0 -73
  366. package/dist/zero/css-writer.js.map +0 -1
  367. package/dist/zero/extractor.d.ts +0 -24
  368. package/dist/zero/extractor.js.map +0 -1
  369. package/docs/PIPELINE.md +0 -519
  370. /package/dist/{chunks/cacheKey.d.ts → ssr/astro-client.d.ts} +0 -0
@@ -0,0 +1,377 @@
1
+ # Runtime Benchmarks
2
+
3
+ Tasty keeps its performance claims in reproducible benchmarks rather than
4
+ combining unlike measurements into one score. The repository measures five
5
+ different costs:
6
+
7
+ 1. Style parsing and generation in Node.
8
+ 2. The React overhead of an empty `tasty({})` wrapper.
9
+ 3. Cold browser generation and injection compared with equivalent CSS that is
10
+ already on the page.
11
+ 4. The steady-state interaction path — mod flips and styled subtrees opening
12
+ and closing after the page has loaded.
13
+ 5. Page-load cold start: network, module compilation, execution and first
14
+ paint, end to end in a throttled browser.
15
+
16
+ The first four are focused microbenchmarks, not page-level scores. The fifth is
17
+ a page-level measurement and is the only one that answers "what does a visitor
18
+ wait for". Run them several times on an otherwise idle machine and use a
19
+ production profile to decide whether any cost matters in an application.
20
+
21
+ ## Reproducing the Results
22
+
23
+ ```bash
24
+ pnpm bench
25
+ pnpm bench:overhead
26
+ pnpm bench:injection
27
+ pnpm bench:interaction
28
+ pnpm bench:cold-start
29
+ ```
30
+
31
+ `pnpm bench` runs the core pipeline benchmarks in Node. The rest use production
32
+ code paths in headless Chromium. The first checkout may require
33
+ `pnpm test:setup` to download Chromium, and `pnpm bench:cold-start` needs a
34
+ current `dist/` — run `pnpm build` first.
35
+
36
+ Run the Node and browser suites separately so they do not compete for CPU. The
37
+ browser timer has 0.1 ms resolution, so the browser benchmarks perform many
38
+ matched operations per sample and divide the absolute difference by the number
39
+ of elements, rules or interactions. Machine load, browser versions, and CPU
40
+ power will move the results — on a loaded machine the absolute columns drift
41
+ several percent while the raw/Tasty delta holds, so read the delta.
42
+
43
+ **On a laptop, check the power state first.** Low Power Mode caps CPU frequency,
44
+ and it is the single largest source of error here — larger than background load.
45
+ Measured on the machine below, running on battery with Low Power Mode enabled
46
+ made every one of the 53 Node cases slower, by a median of 26%, and halving the
47
+ background load recovered only 3 points of that. A frequency cap scales every
48
+ case by roughly the same factor, so it does not look like noise; it looks like a
49
+ uniformly slower library. Verify before trusting a run:
50
+
51
+ ```bash
52
+ pmset -g ps | head -2 # want 'AC Power'
53
+ pmset -g | grep -i lowpowermode # want 0
54
+ ```
55
+
56
+ ## Core Style Pipeline
57
+
58
+ Single-call throughput, three consecutive runs on an Apple M3 Pro with Node
59
+ 24.18.0 on AC power:
60
+
61
+ | Operation | ops/sec | Latency (mean) |
62
+ | ----------------------------------------------------------- | --------------------: | -------------: |
63
+ | `renderStyles` — 5 flat properties (cold) | 143,000–158,000 | 6.3–7.0 us |
64
+ | `renderStyles` — state map with media/hover/modifier (cold) | 31,000–36,000 | 28–32 us |
65
+ | `renderStyles` — OR state map across contexts (cold) | 13,000–14,000 | 71–76 us |
66
+ | `renderStyles` — same styles (cached) | 9,830,000–10,420,000 | ~0.10 us |
67
+ | `parseStateKey` — simple key like `:hover` (cold) | 1,910,000–1,980,000 | ~0.50 us |
68
+ | `parseStateKey` — value modifier key (cold) | 1,120,000–1,160,000 | ~0.90 us |
69
+ | `parseStateKey` — complex OR/AND/NOT key (cold) | 341,000–357,000 | 2.8–2.9 us |
70
+ | `parseStateKey` — any key (cached) | 4,900,000–16,530,000 | 0.10–0.20 us |
71
+ | `parseStyle` — value tokens like `2x 4x` (cold) | 575,000–605,000 | ~1.7 us |
72
+ | `parseStyle` — color tokens (cold) | 1,160,000–1,240,000 | 0.80–0.90 us |
73
+ | `parseStyle` — layered functions (cold) | 175,000–184,000 | 5.4–5.7 us |
74
+ | `parseStyle` — any value (cached) | 29,500,000–30,750,000 | <0.05 us |
75
+
76
+ “Cold” cases use unique inputs to bypass the relevant caches. Cached cases
77
+ reuse one input and measure the LRU hot path. Run-to-run spread on an idle
78
+ machine was 1–7% for most cases, rising to 10–16% for the two `renderStyles`
79
+ cold cases. These benchmarks do not include React, DOM work, stylesheet
80
+ injection, style resolution, layout, or paint.
81
+
82
+ The benchmark sources are colocated with the code they exercise:
83
+ [`pipeline.bench.ts`](../src/pipeline/pipeline.bench.ts),
84
+ [`parseStateKey.bench.ts`](../src/pipeline/parseStateKey.bench.ts), and the
85
+ parser benchmark files under [`src/parser`](../src/parser).
86
+
87
+ ## Empty Wrapper Overhead
88
+
89
+ Skipping the style pipeline does not make a `tasty()` component free. Even
90
+ `tasty({})` is a React component between its parent and the host element. React
91
+ tracks another fiber, and Tasty still processes and forwards the element's
92
+ props.
93
+
94
+ [`tasty-overhead.bench.tsx`](../src/tasty-overhead.bench.tsx) compares 10,000
95
+ raw `<div className>` siblings with 10,000 instances of one module-scoped
96
+ `tasty({})` component. Both receive the same props, and the benchmark fails if
97
+ they do not produce equivalent DOM.
98
+
99
+ The benchmark uses production React in headless Chromium. The factory is
100
+ created and its empty class-name cache is warmed before timing, so factory
101
+ creation, style generation, and injection are excluded. A detached container
102
+ excludes layout, paint, and stylesheet matching. Every commit is wrapped in
103
+ `flushSync`, keeping its synchronous reconciliation and commit inside the
104
+ sample. This does not estimate React's concurrent scheduling latency.
105
+
106
+ On an Apple M3 Pro with React 19.2.8 and Chromium 151, three consecutive runs
107
+ produced these ranges:
108
+
109
+ | Work on 10,000 siblings | Raw elements | `tasty({})` | Extra per wrapped element |
110
+ | ----------------------------------- | -----------: | ----------: | ------------------------: |
111
+ | Mount + remove | 4.2–4.3 ms | 9.2–9.7 ms | 0.50–0.54 us |
112
+ | Rerender, same host props | 1.2–1.3 ms | 6.3–6.5 ms | 0.51–0.52 us |
113
+ | Rerender, change one host attribute | 2.5–2.7 ms | 11.2–11.6 ms | 0.86–0.91 us |
114
+
115
+ The useful result is the raw/Tasty time difference divided by 10,000, not the
116
+ ratio between the two times. The ratio becomes large because the raw baseline
117
+ is tiny. In this synthetic workload, an empty wrapper adds roughly 0.5 us per
118
+ participating element, or ~0.9 us when React also changes a DOM attribute.
119
+
120
+ This is the floor Tasty consumes when it has no styling job. It is not a
121
+ page-level score. Real trees include application components, effects, layout,
122
+ paint, and usually far fewer simultaneous styled-element updates. The benchmark
123
+ also does not measure retained memory; that requires a matched-tree heap
124
+ snapshot experiment with controlled garbage collection.
125
+
126
+ ## Cold Generation and Injection
127
+
128
+ [`tasty-injection.bench.ts`](../src/tasty-injection.bench.ts) measures the extra
129
+ work when Tasty must generate and inject CSS that an otherwise equivalent page
130
+ already has. It does not compare different stylesheet insertion techniques.
131
+
132
+ The benchmark covers two useful workloads:
133
+
134
+ - **One new rule:** add one rule to an existing stylesheet, append its one
135
+ element, and immediately read its computed style. Each timed sample performs
136
+ 50 independent one-rule transactions and reports their total; dividing the
137
+ raw/Tasty difference by 50 produces a stable per-rule result despite
138
+ Chromium's 0.1 ms timer resolution.
139
+ - **1,000 new rules together:** generate and insert all 1,000 rules into one
140
+ stylesheet, append all 1,000 elements, then read every computed color without
141
+ another write in between. This gives the browser one style-resolution
142
+ boundary for the group.
143
+
144
+ For every transaction, the existing-CSS control has the equivalent stylesheet
145
+ parsed, adopted, and attached before timing. The runtime root has a Tasty
146
+ stylesheet pre-created with an unrelated sentinel rule, but not the measured
147
+ rules. Both paths perform the same class assignment, DOM commit, and
148
+ computed-style reads. Only the runtime path calls `computeStyles()` and inserts
149
+ the new rules.
150
+
151
+ Preparation and cleanup happen outside the sample timer. Every runtime style
152
+ value is unique within a cycle, the relevant caches are cleared between cycles,
153
+ and a guard verifies that both paths resolve to the same color. React and the
154
+ `tasty()` wrapper are absent so their independently measured costs do not enter
155
+ the result. Pre-creating both stylesheets also excludes one-time sheet creation
156
+ and adoption from the subtraction.
157
+
158
+ On an Apple M3 Pro with Chromium 151, three consecutive runs produced these
159
+ ranges:
160
+
161
+ | Workload | CSS already present | Tasty runtime | Incremental Tasty cost |
162
+ | ---------------------------------------------------- | ------------------: | -------------: | ---------------------: |
163
+ | One new rule + immediate resolution, per transaction | 2.6–3.0 us | 102.8–107.0 us | 100.3–104.3 us |
164
+ | 1,000 new rules + one resolution | 1.69–1.79 ms | 7.42–7.67 ms | 5.73–5.94 ms |
165
+ | 1,000-rule workload, incremental cost per rule | — | — | 5.7–5.9 us |
166
+
167
+ Directly compared, injecting 1,000 rules before one resolution boundary cost
168
+ about 55–59 times as much in total as injecting one rule and resolving it—not
169
+ 1,000 times as much. Its average incremental cost per rule was about 17–18
170
+ times lower. This is the same Tasty generation and injection path in both cases;
171
+ the group amortizes fixed transaction work and lets the browser resolve all the
172
+ stylesheet writes together.
173
+
174
+ The per-transaction single-rule figure is the one number here that engine work
175
+ does not move: it is dominated by the browser's injection-to-resolution
176
+ boundary, which is crossed once per rule regardless of how fast generation is.
177
+ The 1,000-rule column, where Tasty's own generation dominates, is where engine
178
+ changes show up.
179
+
180
+ The subtraction is the meaningful result. It includes Tasty's cold style
181
+ generation, cache and injector bookkeeping, rule insertion, and any additional
182
+ style invalidation exposed by that workload's resolution boundary. It does not
183
+ pretend to isolate `insertRule()` from the system that calls it.
184
+
185
+ This is a deliberately cold workload. Reused styles resolve from cache and do
186
+ not inject another rule. Different rule complexity, DOM shape, stylesheet size,
187
+ browser, and hardware will change the number. The single-rule and 1,000-rule
188
+ results are not interchangeable: the first crosses the injection-to-resolution
189
+ boundary once per rule, while the second lets the browser resolve 1,000 writes
190
+ together. Because the same resolution pattern is present in each workload's
191
+ control, the difference answers the narrower delivery question: how much extra
192
+ work did Tasty perform when the same CSS was not already there?
193
+
194
+ ## Steady-State Interaction
195
+
196
+ The benchmarks above measure mounting and whole-tree updates. A running
197
+ application spends most of its time on neither. It flips mods — hovered,
198
+ pressed, selected, expanded — on elements whose styles never change, one
199
+ element at a time, and it mounts and unmounts small styled subtrees as menus
200
+ and dialogs open. Both paths go through the state-map and ref-counting
201
+ machinery rather than the parser, so a regression in them is invisible to every
202
+ other benchmark here.
203
+
204
+ [`tasty-interaction.bench.tsx`](../src/tasty-interaction.bench.tsx) pairs each
205
+ case with a raw-DOM equivalent driven by a hand-written stylesheet that
206
+ produces the same computed color and background in both states. The benchmark
207
+ fails if either arm resolves to anything else, so an arm that quietly rendered
208
+ unstyled elements cannot report a flattering number.
209
+
210
+ Each leaf owns its own `useState`, which is what keeps a single-element
211
+ interaction single: re-rendering the root to flip one row would time the whole
212
+ tree. One toggle is far below Chromium's 0.1 ms timer resolution, so a sample
213
+ flips a 100-element tree three times over — 300 commits — and the churn case
214
+ performs 20 open/close cycles. Divide the raw/Tasty difference by those counts.
215
+
216
+ Two things had to be sized deliberately, and both are the difference between a
217
+ readable number and noise:
218
+
219
+ - **The tree is small (100 elements), not large.** React locates a leaf's
220
+ pending update by walking the sibling list, so in a 1,000-element tree a
221
+ single-element update costs ~68 us of traversal — identical in both arms and
222
+ an order of magnitude above anything the styling layer contributes.
223
+ - **The sample resolves style once, not once per flip.** Forcing a recalc
224
+ between flips costs ~70 us in both arms, which buries the delta the same way.
225
+ The browser's side of an interaction is real, but it is the browser's;
226
+ resolution boundaries are what the injection benchmark above measures.
227
+
228
+ The contract check also reads the injected CSS **before** any toggle and fails
229
+ if the hovered rule is not already there. That a style map's states all ship in
230
+ one chunk on first render is the premise of this case; if the hovered rule
231
+ arrived lazily, the first sample would be timing injection.
232
+
233
+ On an Apple M3 Pro with React 19.2.8 and Chromium 151, three consecutive runs:
234
+
235
+ | Workload | Raw elements | Tasty mods | Extra per unit |
236
+ | ---------------------------------------------------- | -----------: | ---------: | -----------------------: |
237
+ | 300 single-element mod toggles in a 100-element tree | 1.7–1.8 ms | 2.0–2.1 ms | 1.2–1.3 us / interaction |
238
+ | 20 mount + unmount cycles of a 200-element subtree | 5.2–5.4 ms | 8.3–8.6 ms | 0.77–0.81 us / element |
239
+
240
+ The absolute columns move several percent with machine load; the delta between
241
+ the arms is the stable quantity, so read that rather than either column.
242
+
243
+ Two things are worth reading out of this.
244
+
245
+ A mod flip on an already-mounted element costs about 1.2 us. The CSS for both
246
+ states already exists — Tasty emits every state of a style map in one chunk on
247
+ first render — so both arms perform the same commit, and what is left is
248
+ Tasty's props and mod handling. That is the same order as the ~0.5 us empty
249
+ wrapper measured above, which is most of where it comes from.
250
+
251
+ Subtree churn is not about styling at all. Its ~0.8 us per element sits right
252
+ on the empty-wrapper mount cost, because the styles are already cached:
253
+ reopening a menu re-pays the React wrapper, not the style pipeline.
254
+
255
+ ## Page-Load Cold Start
256
+
257
+ Every benchmark above deliberately excludes the network, module compilation and
258
+ the first render. [`scripts/cold-start`](../scripts/cold-start) measures exactly
259
+ those: what a visitor waits for between requesting a page and seeing styled
260
+ content, in a real Chromium under CDP network and CPU throttling.
261
+
262
+ Three pages render the same 50 styled components and are verified, before any
263
+ timing, to produce the same 50 elements at the same computed color:
264
+
265
+ - **baseline** — the components server-rendered: identical markup, identical
266
+ class names, a linked stylesheet, and no Tasty on the page. Every other
267
+ column is a delta against this one.
268
+ - **runtime** — Tasty generates the CSS in the browser, as a client-rendered
269
+ application does. The run asserts it really did (69 rules generated).
270
+ - **prewarm** — the same, after one throwaway `computeStyles()` against a
271
+ detached root before the first component renders.
272
+
273
+ Each cell is the median of 5 uncached loads in a fresh browser context. The run
274
+ ends at the first contentful paint, observed through a `PerformanceObserver`
275
+ rather than counted in animation frames — `requestAnimationFrame` fires before
276
+ paint, so a page that commits fast can reach its second frame with nothing
277
+ painted yet.
278
+
279
+ Two things about the payload decide whether this measures a deployment or a
280
+ straw man, so both are enforced rather than assumed:
281
+
282
+ - **Assets are served brotli-compressed**, the way a static host serves them.
283
+ The bundle is 51.5 KB on the wire and 180 KB decoded; putting the decoded
284
+ bytes on a 1.6 Mbps link would add ~700 ms and charge it to Tasty. The run
285
+ reads `encodedBodySize` back out of resource timing and fails if what
286
+ crossed the wire is not the compressed size the table reports.
287
+ - **The bundle is built from what the page imports** (`tasty`, `configure`,
288
+ `computeStyles`, `tastyDebug`), so it is tree-shaken as an application's
289
+ would be. Re-exporting the whole library adds ~4 KB brotli of code no page
290
+ here calls.
291
+
292
+ On an Apple M3 Pro with React 19.2.8 and Chromium 151, first contentful paint:
293
+
294
+ | Link / CPU | baseline | runtime | prewarm | Tasty's cost |
295
+ | --------------------- | -------: | ------: | ------: | -----------: |
296
+ | No throttling, 1x | 36 ms | 40 ms | 40 ms | +4 ms |
297
+ | Fast 4G, 1x | 628 ms | 700 ms | 692 ms | +72 ms |
298
+ | Slow 4G, 1x | 2056 ms | 2320 ms | 2320 ms | +264 ms |
299
+ | No throttling, 4x CPU | 100 ms | 128 ms | 132 ms | +28 ms |
300
+ | Fast 4G, 4x CPU | 656 ms | 724 ms | 740 ms | +68 ms |
301
+ | Slow 4G, 4x CPU | 2068 ms | 2360 ms | 2360 ms | +292 ms |
302
+
303
+ That is one full run of the matrix; a second moved every cell by a few percent.
304
+ The `baseline` column is Tasty-free and identical across runs by construction,
305
+ so its own drift between runs — up to ~8 ms here — is a fair estimate of the
306
+ noise on every cell, and small FCP differences should not be over-read.
307
+
308
+ **The cost is the bundle, not the work.** On Slow 4G the extra transfer alone
309
+ accounts for 260 ms of the 264 ms FCP delta — nearly all of it. Everything
310
+ Tasty then *does* is small by comparison:
311
+
312
+ | Phase (Slow 4G, 1x) | baseline | runtime | prewarm |
313
+ | ----------------------- | -------: | ------: | ------: |
314
+ | js+css transfer | 1433 ms | 1693 ms | 1690 ms |
315
+ | module compile (shared) | 4.1 ms | 3.3 ms | 3.0 ms |
316
+ | tasty top-level execute | — | 1.2 ms | 1.1 ms |
317
+ | `configure()` | — | 0.6 ms | 0.6 ms |
318
+ | prewarm | — | — | 5.2 ms |
319
+ | render 1st component | 3.0 ms | 7.3 ms | 2.8 ms |
320
+ | render 49 more | 1.3 ms | 5.2 ms | 5.0 ms |
321
+
322
+ Importing Tasty costs about 1 ms of top-level execution; `configure()` costs
323
+ half of one. The rest of the CPU delta — about 10 ms for 50 components — is
324
+ generation and injection, which is the cost the injection benchmark isolates.
325
+
326
+ One asymmetry is worth naming: the control links a render-blocking stylesheet
327
+ and the runtime modes have none, so the control's first paint waits for CSS the
328
+ runtime modes never request. That is the real difference between the two
329
+ delivery models, not a thumb on the scale, but it means the FCP delta is not
330
+ purely "what Tasty costs to execute".
331
+
332
+ **Prewarming moves the wake-up, it does not remove it.** The first styled render
333
+ is ~4.5 ms more expensive than the ones after it, because that is when the
334
+ engine's deferred payload is actually compiled. A throwaway `computeStyles()`
335
+ against a detached root pays it early: `render 1st` drops from 7.3 ms to
336
+ 2.8 ms. The prewarm itself costs 5.2 ms, so FCP does not move. It is worth
337
+ doing only when something else can overlap it, or when the first render is on a
338
+ latency-critical path and the page has idle time before it.
339
+
340
+ **Retained heap.** After a forced collection, the runtime page holds about
341
+ 985 KB more than the control (2,605 KB vs 1,619 KB) for 50 components — the
342
+ parser caches, the chunk cache, the injector's registry and the generated CSS.
343
+ The control is not zero either; most of its 1.6 MB is React and the DOM.
344
+
345
+ CPU throttling changes which line moves. At 4x, module compilation of the
346
+ larger graph becomes visible (2.6 ms → 18 ms) where at 1x it is free: V8
347
+ pre-parses at import and compiles lazily, so a slower CPU pays for code the
348
+ faster one never fully compiled. Transfer numbers from the unthrottled cells
349
+ are not worth reading — with no emulated link, resource timings are scheduling
350
+ jitter.
351
+
352
+ ## Reading the Results Together
353
+
354
+ Do not add the microbenchmark numbers together to estimate an application
355
+ blindly. They describe different paths:
356
+
357
+ - A stable `tasty()` factory can skip the style pipeline on later renders, but
358
+ its React wrapper still participates in reconciliation.
359
+ - A cached style avoids cold parsing and generation and does not insert a new
360
+ rule.
361
+ - A genuinely new style pays generation and injection once, then becomes
362
+ reusable.
363
+ - A mod flip on an already-styled element pays neither; it is a class-name
364
+ change.
365
+ - Browser style resolution, layout, and paint depend on the actual document and
366
+ need application-level profiling.
367
+
368
+ The cold-start measurement is the one that puts the rest in proportion. On a
369
+ slow connection, nearly all of Tasty's page-load cost is transferring the
370
+ library — 260 ms of a 264 ms delta — while the generation and injection the
371
+ microbenchmarks obsess over is ~10 ms for 50 components. Bundle size is
372
+ therefore the lever with the largest effect on first paint, and the runtime
373
+ levers matter for what happens after it.
374
+
375
+ The practical optimization target is therefore repeated work: keep style input
376
+ stable when possible, reuse generated chunks, and generate CSS at build or
377
+ server time when runtime flexibility is unnecessary.