基准测试
ttsc 有一套基准把 ttsc + @ttsc/lint + ttsc format 对比 legacy tsc + eslint + prettier,跑在七个真实 TypeScript 项目上;外加一套 @ttsc/graph 的 AI-token 基准。本页是 .codex/skills/benchmark/SKILL.md 的导览——改/跑/发布基准前读那个 skill 全文。
两套基准
性能基准(performance.mjs)
experimental/benchmark/performance.mjs 把每个夹具的三个分支克隆进 experimental/benchmark/.work/、每个 cell 重放 RUNS 次、把中位数写进 website/public/benchmark/performance.json(公共面板 ttsc.dev/benchmark)。
Cell ID = project:branch:op:threading。
图谱 AI-token 基准(graph.mjs)
experimental/benchmark/graph.mjs 是给 @ttsc/graph 与 codegraph 比较器的 AI-token 基准。复用同样的夹具克隆与 setup,顺序跑项目,reasoning effort 固定 high,upsert 进 website/public/benchmark/graph.json。
跑
发布 sweep:
选项族(scope/setup/sampling/host-gate/output/graph-arms)与全部 flag/env 在 .codex/skills/benchmark/SKILL.md 与 experimental/benchmark/README.md 有完整表格。
夹具仓库
每个夹具是外部 GitHub fork samchon/ttsc-benchmark-<name>,加 plugin-heavy 的 samchon/shopping-backend。每个夹具有三个独立分支:
legacy:上游源 + stocktsc/eslint/prettier,TS 固定到面板显示的 Legacy 版本(当前v6.0.3)。ttsc:同源,tsc换成ttsc,跑 tsgotypescript@rc。ttsc-lint:同ttsc,@ttsc/lint折进编译 pass,不再调eslint。
源奇偶约束
三分支只在工具差异(package.json、tsconfig、eslint/prettier 配置、lockfile、ttsc 插件描述符)。应用源在三分支完全一致,所以 cell delta 反映工具成本而非工作负载漂移。
lint/format scope = tsconfig program
跨 legacy 与 ttsc-lint,lint 与 format cell 处理 tsconfig 为该夹具编译的恰好那组文件。program 内不排除、program 外不针对。--ignore-pattern、.prettierignore、额外 files/exclude 都被拒绝,因为它们让 cell 不可比。
编辑工作流
编辑去夹具 GitHub 仓库而非本地克隆。setup 每次 fetch + reset --hard 到上游分支 tip,本地 .work/ 改动立刻消失。每个夹具分支编辑完跑该分支自己的 build/format/lint 命令直到 green,再 commit + push。半成品 tip 会污染后续每次 run(runner 每次 setup 拉上游)。
其他规则
- 夹具里不放 tarball 或构建产物(runner setup 时打包并安装本地 ttsc 工作区)。
- Legacy TS 大版本 bump 时同步更新每个夹具的
legacy分支,保持tsc基线一个 major 跨矩阵。 - 加夹具 = 加一个新
samchon/ttsc-benchmark-<name>仓库(三分支齐)+performance.mjs顶部一个PACKAGE_CONFIGS条目。 - 移除的比较保持移除(
type-fest夹具已故意删;tsgo行是 launcher overhead 的保留参考,不参与 headline winner)。
不变量
- 三分支源奇偶(只差工具)。
- lint/format scope 严格等于 tsconfig program。
- 编辑去 GitHub 仓库,本地克隆是一次性。
- 发布 sweep 用
TTSC_BENCH_REQUIRE_QUIET=1在安静外部主机跑。
维护者提示
- 跑发布 sweep 前确认主机安静(
TTSC_BENCH_REQUIRE_QUIET=1把负载警告升成硬错误)。 - graph-arm 样本若零 MCP 调用或落到 shell 源读,对图谱测量无效,必须重试或留 fail,绝不当比较器中位数。
- 每个基准结果表既要报在 chat/committed 进 website,也要记在活跃 PR 的一条 sticky comment 上(
<!-- ttsc-benchmark-results -->)。
接下来
- 完整细节读
.codex/skills/benchmark/SKILL.md - 构建与测试