benchmark-honestly

构建经得起检验的基准测试工具,旨在识别常见陷阱(如死代码消除、惰性结果、常量折叠、缓存预热、协调遗漏、平均值掩盖 GC 停顿、任务不均衡、机器噪声)。流程包括明确问题定义、控制并披露测试环境、采用预热与交错重复、使用中位数、Bootstrap 置信区间和 Mann–Whitney 检验,并以含置信区间的一行结论输出。集成命令运行器、环境报告器和开环延迟测试器。用于在用户请求“对此进行基准测试”“这个更快吗”“比较性能”“我的改动是否提升了速度”“负载测试”“延迟百分位数”“P99”或发布加速声明时进行验证。

仓库最近推送
GitHub Stars
589
Forks
48
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "benchmark-honestly":https://skillpi.com/zh/skills/deepskill-9f7d04602bdbf49b051c6499b38b9fbd3ebbcc622440c2f3ae1ea0e1e0b03eea。安装前核对上游来源和版本:https://github.com/dotslashsimran/simcraft。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

构建经得起检验的基准测试工具,旨在识别常见陷阱(如死代码消除、惰性结果、常量折叠、缓存预热、协调遗漏、平均值掩盖 GC 停顿、任务不均衡、机器噪声)。流程包括明确问题定义、控制并披露测试环境、采用预热与交错重复、使用中位数、Bootstrap 置信区间和 Mann–Whitney 检验,并以含置信区间的一行结论输出。集成命令运行器、环境报告器和开环延迟测试器。用于在用户请求“对此进行基准测试”“这个更快吗”“比较性能”“我的改动是否提升了速度”“负载测试”“延迟百分位数”“P99”或发布加速声明时进行验证。

0 下载

介绍来源: third_party · dotslashsimran · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
来源文档未说明。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: benchmark-honestly
description: Build benchmarks that survive scrutiny and catch the classic lies (dead code elimination, lazy results, constant folding, warm caches, coordinated omission, averages hiding GC pauses, unequal work, noisy machines). Defines the question first, controls and discloses the environment, uses warmups, interleaved repeats, medians, bootstrap confidence intervals and Mann-Whitney tests, and ends with a one-line verdict that includes the CI. Bundles a command runner, an environment reporter and an open-loop latency tester. Use when the user says "benchmark this", "is this faster", "compare performance", "did my change speed it up", "load test", "latency percentiles", "p99", or posts a speedup claim to check.

Benchmark honestly

A benchmark is a claim: "under these conditions, A takes this long, and B is this much faster, give or take this much". Most published benchmark numbers are wrong because one of those parts is missing. This skill makes every part explicit and runs checks that catch the usual mistakes. Deeper explanations are in reference.md.

Scripts live in ~/simcraft/skills/coding/benchmark-honestly/scripts/. They need only Python 3.9+.

1. Write the question down first

Before running anything, agree on these with the user and write them at the top of the report:

  • What is measured: throughput (work per second) or latency (time per request). For latency, which percentile matters (p50 for typical, p99 or p99.9 for the tail users complain about).
  • Cold or warm: first run after start (caches empty, JIT not compiled) or steady state. These are different questions with different answers.
  • The workload: realistic input sizes and shapes. A 100-element input fits in L1 cache and says nothing about a 10 GB one.
  • What difference matters: "a 2% gain is worth shipping" or "only 20% matters". Pass it as --min-effect.
  • Microbenchmark or end to end: a 3x faster function inside a request that spends 95% of its time on the network changes nothing. Measure end to end before celebrating a micro result.

2. Pick the tool

Use the ecosystem's own tool if it is installed, because it runs in-process with less overhead:

Ecosystem Tool Compare two versions with
Any command hyperfine --warmup 3 -N 'a' 'b' its relative output, or bench.py for CIs
Python pyperf (or pytest-benchmark) pyperf compare_to old.json new.json
JS / TS mitata or tinybench run both in one file
Go go test -bench . -count 20 benchstat old.txt new.txt
Rust criterion --save-baseline then --baseline

Otherwise, or to get the statistics and the checks, use the bundled runner:

python3 scripts/bench.py -n old -n new "python3 old.py" "python3 new.py" \
  --runs 30 --warmup 3 --floor "python3 -c pass" --same-output \
  --md report.md --json report.json --chart chart.svg --redact

The first command is the baseline. It runs warmups, then shuffled rounds so drift hits every variant equally, records wall time, CPU time and peak memory, and prints medians, bootstrap CIs, a Mann-Whitney test, Cliff's delta and a verdict. --floor takes an empty version of the program (same startup, no work) and flags any variant that is not clearly slower than it. --same-output flags variants that print different results. --prepare CMD runs before every timed run (for example to evict a cache). --subtract-floor compares the work alone, without startup.

For latency under load, use the open-loop tester, never a loop that waits for each reply before sending the next:

python3 scripts/latency_test.py --url http://127.0.0.1:8080/ --rate 200 --duration 30 --md latency.md

3. Control the environment, then disclose it

Run python3 scripts/env_report.py --redact before and after (bench.py includes it automatically). Fix what it warns about: plug in the laptop, turn off low power mode, close busy apps, on Linux set the governor to performance and pin with taskset. On macOS you cannot pin cores or turn off turbo, and Apple Silicon may put the run on slow efficiency cores; say so in the report. Check that you are timing a release build (-O2, --release, NODE_ENV=production), not a debug build.

4. Check for the lies

Go through the list in reference.md ("The lies") for the code at hand. The short version:

  • Is the result used? (dead code, lazy iterators, constant folding). Print or return a checksum.
  • Is every variant doing the same work on the same input? Compare outputs.
  • Did the previous run warm a cache for the next one? Shuffle the order, and say if the numbers are warm or cold.
  • Is the work bigger than the timer and startup cost? Compare against the floor.
  • Is latency measured from the intended send time? Is the tail reported, not just the mean?

5. Report

Every report has: the question, a chart showing every run (not just a bar), the setup table, the exact command to reproduce, and one honest line, for example "new is 1.18x faster than old (95% CI 1.09x to 1.27x, 30 runs each, warm cache, M2 laptop on AC power)". If the CI includes 1.0, the line says there is no clear difference. Never report a speedup from a single run or from means alone.

Examples

examples/ has four real cases run on a busy laptop, each with the naive result next to the honest one: a lazy map() that looks 100,000x faster, two identical sorts where single runs give a different "winner" each time, a file read where whichever variant runs first loses, and a server with GC-like pauses whose p99 looks fine in a closed loop. See examples/README.md.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值95/100

亮点

  • 提供系统化的基准测试方法论,有效识别常见性能陷阱
  • 集成命令行运行器、环境报告器和延迟测试器,形成完整工具链
  • 适用于开发者性能优化验证的高频刚需场景
触发精准98/100

亮点

  • 触发词覆盖全面,包括'benchmark this'、'p99'、'latency percentiles'等关键短语
  • 边界清晰,不易与其他Skill混淆
结构规范75/100

待提升项

  • 缺少显式When to Use章节 原报告严重程度:轻微

    文档虽在description中说明了使用场景,但未在正文设立独立When to Use章节

    改进建议:建议在正文开头增加显式的When to Use章节以提升可读性

  • 文档长度略长 原报告严重程度:轻微

    主文档约600行,可能影响快速查阅

    改进建议:考虑将部分详细说明移至reference.md或examples目录

亮点

  • Phase划分清晰(5个步骤),逻辑连贯
  • 提供具体命令示例和参数说明,便于直接执行
执行可靠85/100

待提升项

  • 脚本路径依赖固定位置 原报告严重程度:轻微

    scripts路径硬编码为~/simcraft/skills/coding/benchmark-honestly/scripts/,可能与环境不符

    改进建议:建议改为相对路径或提供路径配置选项

亮点

  • 参数设计完善(--warmup, --same-output, --floor等)有效控制干扰因素
  • 自动检测输出一致性和缓存影响,提升结果可信度
  • 支持Bootstrap置信区间和Mann-Whitney检验,统计方法严谨
证据可验 (前四项均值)88/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • 127.0.0.1

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。