Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ the two TeaCSS engines are separate ecosystems that share no package

The subjects now pin TeaCSS 0.10 under spec revision 10: teacss-rs 0.10.5 and
teacss-ts 0.10.5, two ecosystems that share no package, on Node 26
([ADR-0005](notes/adrs/ADR-0005-two-teacss-ecosystems.md)). TeaCSS 0.10 has no
published run yet, so the block below still shows 0.9.3, and its numbers do
not carry over to 0.10.
([ADR-0005](notes/adrs/ADR-0005-two-teacss-ecosystems.md)).

Seven published runs; the latest (2026-10-25) measures TeaCSS 0.9.3 across
Vite, PostCSS, Rsbuild and Bun under spec revision 8. Revisions 5 to 8 made
each subject process match what a CLI user gets: the compile cache and the
Eight published runs; the latest (2026-11-03) is the first of TeaCSS 0.10,
across Vite, PostCSS, Rsbuild, Bun and the two CLIs
([what changed in 0.10](notes/articles/teacss-0.10.5.md)). Its Node binary adds
about 70 ms to every Node process, which favours no tool but makes absolute
build times high; the [audit](notes/reports/2026-11-03T13-22-12-mac.audit.md)
explains it. The seventh run measured TeaCSS 0.9.3 under spec revision 8.
Revisions 5 to 8 made each subject process match what a CLI user gets: the compile cache and the
`NODE_ENV` the `vite` and `rsbuild` CLIs set, only the packages the task uses,
and a run that is discarded when the machine gets busy mid-run. Build, dev and
cold-engine numbers are therefore not comparable with earlier runs. Revision 6
also corrected a bias that made every earlier TypeScript-engine dev number too
fast. The CSS is byte-for-byte the same as 0.9.0
fast. The CSS of 0.9.3 is byte-for-byte the same as that of 0.9.0
([what changed in 0.9.2 and 0.9.3](notes/articles/teacss-0.9.3.md)). Two
articles explain the 0.9.0 round in plain language:
[the TypeScript engine against the Rust engine](notes/articles/teacss-0.9.0-ts-vs-rust.md)
Expand All @@ -37,63 +39,62 @@ is written for developers who want the answer without reading the full report.

<!-- bench:summary:start -->

### Results from 2026-10-25
### Results from 2026-11-03

**Generating the CSS for 20,000 classes** (median of 30 runs)

| | Time |
| --- | --- |
| TeaCSS (Rust engine) | 52 ms |
| Tailwind CSS v4 | 232 ms (4.5× slower) |
| TeaCSS (TypeScript engine) | 495 ms (9.6× slower) |
| TeaCSS (Rust engine) | 42 ms |
| Tailwind CSS v4 | 226 ms (5.4× slower) |
| TeaCSS (TypeScript engine) | 466 ms (11.1× slower) |

**Adding new classes to an engine** that already holds those 20,000 (median of 30 runs)

| | +10 classes | +100 classes |
| --- | --- | --- |
| TeaCSS (Rust engine) | 18 ms | 19 ms |
| TeaCSS (TypeScript engine) | 112 ms (6.1× slower) | 117 ms (6.3× slower) |
| Tailwind CSS v4 | 140 ms (7.7× slower) | 145 ms (7.8× slower) |
| TeaCSS (Rust engine) | 6.2 ms | 7.4 ms |
| Tailwind CSS v4 | 116 ms (18.5× slower) | 123 ms (16.7× slower) |
| TeaCSS (TypeScript engine) | 116 ms (18.6× slower) | 124 ms (16.7× slower) |

**Saving a new file in the Vite dev server** with 20,000 classes already in 300 files, until the page's stylesheet has the new classes (median of 30 runs)

| | +10 classes | +100 classes |
| --- | --- | --- |
| TeaCSS (Rust engine) | 77 ms | 73 ms |
| TeaCSS (TypeScript engine) | 311 ms (4.1× slower) | 321 ms (4.4× slower) |
| Tailwind CSS v4 | 324 ms (4.2× slower) | 311 ms (4.2× slower) |
| TeaCSS (Rust engine) | 74 ms | 81 ms |
| TeaCSS (TypeScript engine) | 271 ms (3.7× slower) | 300 ms (3.7× slower) |
| Tailwind CSS v4 | 310 ms (4.2× slower) | 322 ms (4.0× slower) |

**Building a Vite project with those classes in 300 files** (median of 30 runs; the project builds in 185 ms with no CSS tool)
**Building a Vite project with those classes in 300 files** (median of 30 runs; the project builds in 250 ms with no CSS tool)

| | Build | of which CSS |
| --- | --- | --- |
| TeaCSS (Rust engine) | 405 ms | 220 ms |
| Tailwind CSS v4 | 759 ms (1.9× slower) | 574 ms |
| TeaCSS (TypeScript engine) | 1.02 s (2.5× slower) | 831 ms |
| TeaCSS (Rust engine) | 388 ms | 139 ms |
| Tailwind CSS v4 | 779 ms (2.0× slower) | 529 ms |
| TeaCSS (TypeScript engine) | 1.04 s (2.7× slower) | 793 ms |

**What the Rust engine changes for TeaCSS**

| | TypeScript engine | Rust engine |
| --- | --- | --- |
| Generate the CSS (warm process) | 495 ms | 52 ms (9.6× faster) |
| Add 10 classes to a running engine | 112 ms | 18 ms (6.1× faster) |
| Dev server: save a file with 10 new classes | 311 ms | 77 ms (4.1× faster) |
| Vite production build | 1.02 s | 405 ms (2.5× faster) |
| Resident memory after generating | 748.1 MB | 381.2 MB (2.0× less) |
| Same CSS output | | byte-identical in every measured case |
| Generate the CSS (warm process) | 466 ms | 42 ms (11.1× faster) |
| Add 10 classes to a running engine | 116 ms | 6.2 ms (18.6× faster) |
| Dev server: save a file with 10 new classes | 271 ms | 74 ms (3.7× faster) |
| Vite production build | 1.04 s | 388 ms (2.7× faster) |
| Resident memory after generating | 699.0 MB | 294.3 MB (2.4× less) |
| Same CSS output | | byte-identical from the engines and the Vite builds; the dev servers differ in the bundled fonts only, which @teacss/vite inlines and @teacss/vite-ts links |

**In short**

- TeaCSS (Rust engine) is fastest both at generating the CSS and at finishing the build.
- Generating the CSS is only part of the build's CSS cost: 24 % for TeaCSS (Rust engine). The rest is the build plugin, so a faster engine does not by itself give a faster build.
- For the same classes, Tailwind CSS v4 emits 2.6× the CSS of TeaCSS: 30,010 rules against 4,832. Part of its build time goes to producing that extra output.
- The price of the Rust engine is a native file of 8.4 MB per platform (8 platform packages), loaded in 1.2 ms. It served 6 of the 6 example configurations it was given.
- For the same classes, Tailwind CSS v4 emits 2.6× the CSS of TeaCSS: 30,010 rules against 4,834. Part of its build time goes to producing that extra output.
- The price of the Rust engine is a native file of 9.2 MB per platform (8 platform packages), loaded in 2.4 ms. It served 2 of the 2 example configurations it was given.
- Every tool was given the same classes, and before anything was timed each tool's output was checked against them; every timed call that added classes was checked for those classes. The tools emit different colour and size values by design, so this is the time to a correct stylesheet, not to identical bytes.
- vite 8.3.4, @teacss/core 0.9.3, @teacss/engine 0.9.3, tailwindcss 4.3.3; one Apple M2 Max, Node v24.14.1. Milliseconds will differ on your machine; the ratios carry over.
- With each tool's out-of-the-box entry instead of the tuned one, the build takes 0.98× as long for TeaCSS (Rust engine), 0.99× as long for TeaCSS (TypeScript engine) and 1.00× as long for Tailwind CSS v4, so the comparison does not hinge on one tool's configuration.
- On other build tools: with Rsbuild, TeaCSS (Rust engine) adds 304 ms to the build and Tailwind CSS v4 adds 992 ms, so TeaCSS (Rust engine) adds less; with Bun (Bun runtime), TeaCSS (Rust engine) adds 153 ms to the build and Tailwind CSS v4 adds 340 ms, so TeaCSS (Rust engine) adds less. The Build tools section of the full report sets them beside Vite.
- vite 8.3.4, @teacss/core 0.10.5, @teacss/engine 0.10.5, tailwindcss 4.3.3; one Apple M2 Max, Node v26.12.0. Milliseconds will differ on your machine; the ratios carry over.
- With each tool's out-of-the-box entry instead of the tuned one, the build takes 0.97× as long for TeaCSS (Rust engine), 1.00× as long for TeaCSS (TypeScript engine) and 1.01× as long for Tailwind CSS v4, so the comparison does not hinge on one tool's configuration.
- On other build tools: with Rsbuild, TeaCSS (Rust engine) adds 310 ms to the build and Tailwind CSS v4 adds 960 ms, so TeaCSS (Rust engine) adds less; with Bun (Bun runtime), TeaCSS (Rust engine) adds 96 ms to the build and Tailwind CSS v4 adds 320 ms, so TeaCSS (Rust engine) adds less. The Build tools section of the full report sets them beside Vite.

[Full report](notes/reports/2026-10-25T12-05-32-mac.md) · [audit](notes/reports/2026-10-25T12-05-32-mac.audit.md) · [raw samples](results/2026-10-25T12-05-32-mac.json) · [method](notes/specs/v01.1-benchmark-protocol.md)
[Full report](notes/reports/2026-11-03T13-22-12-mac.md) · [audit](notes/reports/2026-11-03T13-22-12-mac.audit.md) · [raw samples](results/2026-11-03T13-22-12-mac.json) · [method](notes/specs/v01.1-benchmark-protocol.md)

<!-- bench:summary:end -->

Expand Down
1 change: 1 addition & 0 deletions notes/articles/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
| [teacss-0.9.0-vs-tailwind-v4](teacss-0.9.0-vs-tailwind-v4.md) | TeaCSS 0.9.0(Rust 引擎)与 Tailwind CSS v4.3:117 组比较里 TeaCSS 赢 102 组,Tailwind 赢 10 组(都是 1 000 个类的小项目构建,领先 7 到 29 ms),5 组持平;附公平性核对与复现命令。 |
| [teacss-0.9.1](teacss-0.9.1.md) | TeaCSS 0.9.1 与 0.9.0:产物逐字节相同;开发服务器保存从 100 降到 70 ms(Rust 引擎),Vite 构建 -12 ms,引擎不变;四项改动各自在未发布通道里的效果;对 Tailwind 117 组比较 102 胜 8 负 7 持平,小项目构建里 Tailwind 的领先缩小到 8 张表。 |
| [teacss-0.9.3](teacss-0.9.3.md) | TeaCSS 0.9.2 与 0.9.3:Rust 引擎成为默认,产物逐字节不变;协议修订 5 与 6(编译缓存与 `NODE_ENV` 都按命令行设置);更正:TypeScript 引擎开发服务器「变慢」其实是旧测法偏快;协议修订 7 与 8(只加载本任务用到的包、中途负载过高作废);对 Tailwind 117 组比较 110 胜 3 负 4 持平。 |
| [teacss-0.10.5](teacss-0.10.5.md) | TeaCSS 0.10.5(teacss-rs 与 teacss-ts 两个生态)的第一轮正式测试:对 Tailwind 117 组比较 116 胜 1 持平,小项目构建也全部领先;加 10 个类从 18 降到 6.2 ms;新增命令行组;开发服务器只差内置字体的发送方式;Homebrew 的 Node 让每个 Node 进程多约 70 ms,不偏向任何工具。 |
91 changes: 91 additions & 0 deletions notes/articles/teacss-0.10.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# TeaCSS 0.10.5:两个生态的第一轮正式测试

**结论。** TeaCSS 0.10 拆成了两个互不共享包的生态:teacss-rs 只用 Rust 引擎,teacss-ts 只用 TypeScript 引擎。这是 0.10 的第一轮正式测试,两边都是 0.10.5。在 20 000 个类、300 个文件的项目里:

- 开发服务器里保存一个文件:teacss-rs 74 ms,teacss-ts 271 ms,Tailwind CSS v4 311 ms;
- Vite 生产构建里 CSS 那部分:teacss-rs 加 139 ms,Tailwind 加 529 ms,teacss-ts 加 793 ms;
- 往运行中的引擎里加 10 个类:teacss-rs 从 0.9.3 的 18 ms 降到 6.2 ms。

和 Tailwind 的 117 组正面比较里,teacss-rs 赢 116 组,1 组无可测差异,没有输的。上一轮 Tailwind 还在 3 张小项目构建表里领先,这一轮 1 000 个类的 15 张构建表都是 teacss-rs 更快,领先 27 到 55 ms。

## 0.10 改了什么

- **没有引擎开关了。** 0.9 里同一套包可以切换引擎;0.10 里 `@teacss/vite`、`@teacss/postcss`、`@teacss/rsbuild`、`@teacss/bun` 和 `teacss` 命令行属于 teacss-rs,`@teacss/vite-ts` 和 `@teacss/cli` 属于 teacss-ts。基准不再靠环境变量确认引擎,而是看进程实际加载了哪个原生模块。
- **teacss-ts 只发布 Vite 插件和命令行。** 所以 PostCSS、Rsbuild、Bun 三组里只有 Rust 引擎一个 TeaCSS 对象。
- **新增命令行组。** 20 000 个类、300 个文件时,`teacss build` 要 340 ms,`teacss-cli` 要 2 778 ms。这一组没有 Tailwind。
- **输出。** 两个引擎、两个 Vite 插件的构建产物逐字节相同;两个命令行在字体地址换成摘要后相同。开发服务器有一处不同,见下文。

## 20 000 个类、300 个文件

每格 30 次交替运行的中位数:

| 场景 | TeaCSS(Rust 引擎) | Tailwind CSS v4 | TeaCSS(TypeScript 引擎) |
| --- | --- | --- | --- |
| 全新进程,从启动到生成完 | 55 ms | 314 ms | 640 ms |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Describe cold-engine timing without including process startup

The row describes elapsed time from process startup to completed generation, but runEngineScenario() starts its cold timer inside the already-running subject process, immediately before importing the subject and calling its engine (packages/benchmark/src/features/measure/engine-scenario.ts:43–46). Node startup and harness initialization are excluded. Consequently, the 55 ms figure is not a spawn-to-output measurement, and the audit's statement that cold-engine timings include the extra approximately 70 ms of Homebrew startup overhead is also incorrect. Label this row as subject loading plus first generation, and clarify that the startup-overhead caveat applies to externally timed builds and CLIs rather than cold-engine samples.

AGENTS.md reference: AGENTS.md:L11-L12

Useful? React with 👍 / 👎.

| 在已经启动的进程里生成全部 CSS | 42 ms | 226 ms | 466 ms |
| 往运行中的引擎里加 10 个类 | 6.2 ms | 116 ms | 116 ms |
| 开发服务器里保存一个带 10 个新类的文件 | 74 ms | 311 ms | 271 ms |
| Vite 生产构建 | 388 ms | 779 ms | 1 043 ms |

各构建工具里,CSS 工具在基线之上加的时间:

| 构建工具 | 基线 | TeaCSS(Rust 引擎) | Tailwind CSS v4 |
| --- | --- | --- | --- |
| Vite | 250 ms | +139 ms | +529 ms |
| Vite + PostCSS | 250 ms | +207 ms | +715 ms |
| Rsbuild | 246 ms | +310 ms | +960 ms |
| Bun(Bun 运行时) | 68 ms | +96 ms | +320 ms |

## 为什么毫秒数都变大了:Node 二进制

teacss-rs 0.10 要求 Node 26,所以这一轮从 Node 24.14.1 换到了 Node 26.12.0。Vite 基线在每一格都多了约 75 ms,从 146 到 185 ms 变成 223 到 261 ms。

原因不在 Node 26 本身,而在这台机器上的 Node 是 Homebrew 编译的版本。它动态链接了 `libnode` 和几十个 Homebrew 库,每次启动都要先加载它们:

- 空进程 `node -e 0`:Homebrew 的 Node 26.12.0 要 102 ms,官方的 Node 26.7.0 要 32 ms,Node 24.12.0 要 28 ms。
- 同一个小项目的 Vite 构建:Node 24.12.0 要 107 ms,Homebrew 的 Node 26.12.0 要 180 ms。

每个 Node 进程都多付这约 70 ms,所有工具一样,两个命令行也一样(它们都通过 `#!/usr/bin/env node` 启动)。所以:

- 各工具在基线之上加的时间不受影响;
- 构建的倍数被压小了:去掉这 70 ms,Vite 构建 Rust 引擎对 Tailwind 的领先约为 2.2 倍,而不是表里的 2.0 倍。这对 TeaCSS 不利,不是有利;
- Bun 组不用 Node,不受影响。

换成官方的 Node 26.12.0 二进制重跑,就能去掉这部分。在那之前,构建和命令行的绝对时间请按偏高约 70 ms 来读。

同样因为换了 Node,这一轮的毫秒数不能直接和以前的报告比。Tailwind 版本没变,它的「加 10 个类」也从 140 变成了 116 ms,这是 Node 的变化,不是 Tailwind 的变化。

## 开发服务器的样式表不同,但只差字体

构建产物逐字节相同,开发服务器返回的样式表却在每一格都正好差 144 928 字节。差的是四个内置字体:

- `@teacss/vite` 在开发时把字体内联成 data URI;
- `@teacss/vite-ts` 把它们链接到 `/__teacss_fonts/`。

把每个字体换成它的摘要后,两份样式表完全相同。Rust 插件每次多发约 145 KB,如果有影响,也是让它更慢。报告生成器以前把引擎以外的任何差异都解释成修订 9 的 Lightning CSS 问题,这次改成分开统计 Vite 构建和开发服务器,并写明是字体。

## 对 TeaCSS 仍然不利的地方

- **TypeScript 引擎的构建仍比 Tailwind 慢。** 它参与的 18 组构建比较全部更慢。
- **TypeScript 命令行明显慢。** 300 个文件时 `teacss-cli` 要 2.2 到 2.8 秒,`teacss build` 约 0.3 秒。
- **TypeScript 引擎占内存更多。** 生成一次后常驻约 700 MB,Rust 引擎约 294 MB,Tailwind 约 530 MB。这个读数取决于垃圾回收最后一次运行的时机。

## 公平性

- 全部用 npm 上的发布版;
- 计时前逐类校验,78 000 个用例零差异;
- 所有对象逐轮随机交替,每格 30 次;
- 负载连续两分钟低于 2.4 才开始,各格负载份额 21% 到 42%,任何一格超过 50% 就作废;
- teacss-ts 和 teacss-rs 两个开发会话在整轮期间都停下了自己的构建和测试;
- 所有 Node 构建和开发服务器都使用命令行会设的编译缓存与 `NODE_ENV`,并且只加载本任务用到的包。

限制:

- 只有一台 Apple M2 Max,Linux 交叉验证未跑;
- Homebrew 的 Node 让每个 Node 进程多约 70 ms,见上文;
- 只有生成的配对语料,社区语料还在等仓库清单;
- 本基准的作者也开发 TeaCSS。

## 出处

数字来自[第八份正式报告](../reports/2026-11-03T13-22-12-mac.md)和它的[原始记录](../../results/2026-11-03T13-22-12-mac.json),审核见[这里](../reports/2026-11-03T13-22-12-mac.audit.md)。上一轮 0.9.3 的结果见[第七份报告](../reports/2026-10-25T12-05-32-mac.md)和[那一轮的文章](teacss-0.9.3.md)。
Loading
Loading