benchmark-optimization-loop
它能做什么
这个工具可以帮你有条理地让程序或流程运行得更快。它会测试不同版本,找出最高效的那个,同时不破坏已有的正常功能。
适用场景
- ✓当你希望某个东西运行得更快时。
- ✓当你想一次尝试多种改进时。
- ✓当你想找到让某件事运行得最好的方法时。
技能链接
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/benchmark-optimization-loop/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“尝试把这段代码提速 10 倍,并确保它仍然能正确运行。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先测量当前的性能,作为基线。然后,它每次只做小幅改动,生成并测试几个版本。最后,它会选出通过所有质量测试、速度最快的版本。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Benchmark Optimization Loop
Use this skill to convert "make it 20x faster" or "try 50 recursive optimizations" into a bounded measured loop that can actually improve a system.
Required Baseline
Do not optimize until these exist:
- the operation being optimized;
- the correctness gate that must stay green;
- the metric: wall time, p95 latency, rows/sec, cost/run, memory, error rate;
- the current baseline;
- the search budget: max variants, max time, max spend, max data impact.
If the user asks for an unrealistic target, keep the ambition but make the loop bounded and measurable.
Loop
- Measure the baseline.
- Identify bottlenecks from evidence.
- Generate variants that test one hypothesis each.
- Run variants with the same input shape.
- Reject variants that fail correctness, safety, or reproducibility.
- Promote the fastest safe variant.
- Codify the winning path in a script, command, test, config, or doc.
- Rerun the baseline and winner to confirm the delta.
Variant Table
Track variants like this:
Variant | Hypothesis | Command | Time | Correct? | Notes
baseline | current path | npm run job | 120s | yes | stable
batch-500 | fewer round trips | npm run job -- --batch 500 | 42s | yes | winner
parallel-8 | more workers | npm run job -- --workers 8 | 31s | no | rate limited
Recursive Search
For recursive or hyperparameter work:
- persist every run to a ledger;
- compare against the prior accepted winner, not only the previous run;
- keep a holdout or replay check;
- stop when improvement is within noise, correctness fails, cost exceeds the budget, or the search starts changing more variables than it can explain.
Use phrases like "best measured safe variant" instead of "global optimum" unless the search space was actually exhaustive.
Promotion Gate
A variant cannot become the new default until:
- correctness tests pass;
- the performance delta is repeated or explained;
- rollback is obvious;
- the change is encoded in source control or a durable runbook;
- the final summary includes exact commands and measurements.
常见问题
什么是“基线”?
基线是你的程序在进行任何优化尝试之前的初始性能。
什么是“正确性门禁”?
它是一组测试,用来确保程序在修改后仍能按预期运行。
AI 怎么知道哪个版本最好?
它会比较每个测试版本的速度和正确性,然后推荐既最快又能正确运行的那个。
详情
作者的原始描述
Convert 'make it faster' requests into a bounded measured optimization loop — baseline first, generate one-hypothesis variants, benchmark each against a correctness gate, and promote the fastest safe variant with reproducible commands. Use when asked to speed something up, try many variants, run recursive optimization, benchmark latency/throughput/cost, or pick the best implementation by repeated
repo: affaan-m/ECC
热度
- GitHub 星标
- 280k
- 排名
- #141
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
accessibility
280k帮你的智能体创建人人都能使用的界面。确保网站和应用对残障人士友好,比如失明或行动不便的用户也能顺畅使用。
agent-architecture-audit
280k让你的智能体检查一切是否正常运行。它能找出并修复 AI 系统中的问题,确保系统按预期工作。
agent-eval
280k帮你的智能体比较不同的 AI 编程工具。它能衡量哪个工具在特定任务上更快、更便宜、更可靠。
agent-harness-construction
280k让你的智能体更好地理解如何完成任务。它会优化智能体使用的工具和指令,提高成功的几率。