Benchmark

affaan-m/ECC/docs/zh-CN/skills/benchmark

by affaan-mef648e01899ba3e8dc6371642deaaf64b4477775No license275K starsListed Oct 9, 2026Updated Oct 9, 2026Repository updated 4 days ago

使用此技能测量性能基线,检测PR前后的回归,并比较堆栈替代方案。

Instructions onlyData & Analytics
AI-generated overview

Measures performance baselines, detects regressions before and after PRs, and compares stack alternatives.

What it does
This skill defines a benchmarking workflow with four modes: page performance via browser metrics, API endpoint latency testing, build and dev-loop timing, and before/after comparison against a saved baseline. It records metrics such as LCP, CLS, INP, bundle size, p50/p95/p99 latency, and build times, then reports deltas in a table with verdicts. Baseline data is stored as JSON in a project directory and tracked through Git for team sharing.
When to use it
Use it when measuring the performance impact of a change before and after a pull request, establishing a project performance baseline, investigating user reports that something feels slower, verifying performance targets before a release, or comparing the performance of different technology stacks.
Requirements
Instructions only, with no bundled scripts. It relies on a browser MCP for page metrics and on the project's own build, test, lint, and TypeScript tooling for build measurements; it also writes baseline JSON files into the repository.

基准测试 — 性能基线及回归检测

使用场景

  • 在 PR 前后测量性能影响
  • 为项目建立性能基线
  • 用户反馈"感觉变慢"时
  • 发布前确保达到性能目标
  • 对比不同技术栈的性能表现

工作原理

模式 1:页面性能

通过浏览器 MCP 测量真实浏览器指标:

1. 导航至每个目标 URL2. 测量核心网页指标:   - LCP(最大内容绘制)— 目标 < 2.5 秒   - CLS(累积布局偏移)— 目标 < 0.1   - INP(与下一次绘制的交互)— 目标 < 200 毫秒   - FCP(首次内容绘制)— 目标 < 1.8 秒   - TTFB(首字节时间)— 目标 < 800 毫秒3. 测量资源大小:   - 页面总重量(目标 < 1MB)   - JS 包大小(目标 < 200KB gzip 压缩后)   - CSS 大小   - 图片重量   - 第三方脚本重量4. 统计网络请求数量5. 检查阻塞渲染的资源

模式 2:API 性能

对 API 端点进行基准测试:

1. 每个端点请求 100 次2. 测量:p50、p95、p99 延迟3. 追踪:响应大小、状态码4. 负载测试:10 个并发请求5. 与 SLA 目标进行对比

模式 3:构建性能

测量开发反馈循环效率:

1. 冷构建时间2. 热重载时间 (HMR)3. 测试套件执行时间4. TypeScript 检查时间5. 代码检查时间6. Docker 构建时间

模式 4:前后对比

在变更前后运行以测量影响:

/benchmark baseline    # 保存当前指标# ... 进行更改 .../benchmark compare     # 与基线进行比较

输出结果:

| Metric | Before | After | Delta | Verdict ||--------|--------|-------|-------|---------|| LCP | 1.2s | 1.4s | +200ms | WARNING: WARN || Bundle | 180KB | 175KB | -5KB | ✓ BETTER || Build | 12s | 14s | +2s | WARNING: WARN |

输出

将基线数据以 JSON 格式存储在 .ecc/benchmarks/ 中。通过 Git 追踪,便于团队共享基线。

集成

  • CI:在每个 PR 上运行 /benchmark compare
  • 配合 /canary-watch 进行部署后监控
  • 配合 /browser-qa 完成发布前完整检查清单

Source and attribution

Source:affaan-m/ECCindocs/zh-CN/skills/benchmarkat commitef648e0

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal