跳到正文
Skillpedia
通用编程280k · #141

benchmark-optimization-loop

它能做什么

这个工具可以帮你有条理地让程序或流程运行得更快。它会测试不同版本,找出最高效的那个,同时不破坏已有的正常功能。

适用场景

  • ✓当你希望某个东西运行得更快时。
  • ✓当你想一次尝试多种改进时。
  • ✓当你想找到让某件事运行得最好的方法时。

技能链接

https://github.com/affaan-m/ECC/blob/main/pi/core/skills/benchmark-optimization-loop/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/affaan-m/ECC/blob/main/pi/core/skills/benchmark-optimization-loop/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Measure the baseline.
  2. Identify bottlenecks from evidence.
  3. Generate variants that test one hypothesis each.
  4. Run variants with the same input shape.
  5. Reject variants that fail correctness, safety, or reproducibility.
  6. Promote the fastest safe variant.
  7. Codify the winning path in a script, command, test, config, or doc.
  8. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能