Run Benchmark 标志

Run Benchmark

社区
onevcat
run-benchmark

运行 Prowl 的性能基准测试层,对比当前分支或某个版本与已记录的基线,并生成持久保存在本地的报告。仅当用户明确调用 run-benchmark,或明确要求运行性能基准测试/验证性能影响时使用。实现工作完成后不要自动调用。先判断用户的意图属于热路径变更、新优化,还是版本级全面测试,并与用户确认后,再运行相应的测试层。

Add to TypingMind

概览

发布者onevcat
代码仓库Prowl
技能名称run-benchmark
星标数
647
复刻数
66
附带文件
仅含指令
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 onevcat 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Run Benchmark AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/onevcat/Prowl/tree/main/.claude/skills/run-benchmark
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/onevcat/Prowl.git /tmp/Prowl
mkdir -p .claude/skills
cp -r /tmp/Prowl/.claude/skills/run-benchmark .claude/skills/run-benchmark
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Run Benchmark,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Run Benchmark。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Run Benchmark 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Run Benchmark

Invocation contract

Run this skill only after an explicit user request. Implementing, fixing, or reviewing performance-adjacent code does not by itself authorize a benchmark run.

All timing in this workflow assumes one dedicated, quiet local machine accumulating a series over time. Numbers from CI runners, other machines, or a loaded host are not comparable and must not enter the baseline series. Never run other builds, tests, or heavy agents concurrently with a timed run.

Background and design decisions live in docs-ai/057-performance-benchmark-suite/; the measurement methodology (why workload context matters, why load kills comparability) in docs-ai/032-performance-hardening/004-agent-detection-steady-state.md.

Step 0 — Preflight

  1. git status --short — an A/B run switches the checkout to the baseline commit, so the tree must be clean and HEAD committed. If dirty, tell the user what is blocked and ask whether to commit/stash or fall back to a branch-only run.
  2. Quiet-host check: compare uptime load1 against sysctl -n hw.ncpu. Above roughly half the cores, warn that starvation inflates numbers unevenly and ask whether to wait or proceed; above one runnable process per core, refuse the timed run and say why.
  3. Note what is available for the live layer: is a Prowl instance running (prowl list --json), and are any agents working (animating titles)?

Step 1 — Classify intent, then always confirm

Gather evidence before guessing:

  • The user's own words in the invocation — these override everything below.
  • git branch --show-current; BASE=$(git merge-base HEAD origin/main); git diff --name-only $BASE and git log --oneline $BASE..HEAD.
  • Map changed files through the table in Reference to see which benchmark suites the branch can plausibly affect.

Classify into one of three modes:

ModeSignalWhat runs
hot-pathBranch touches files mapped to existing suites; user wants to know whether the change regressed themA/B make bench: merge-base baseline vs branch
new-optimizationBranch introduces a performance improvement no suite pins yetAdd a benchmark first (057 pattern), then the hot-path A/B
releasePre-release or "how is performance overall" with no specific change in questionmake test + make bench vs trailing series + live layer

Then confirm with the user before running anything, even when the evidence is clear: present the guessed mode with its one-line evidence and the alternatives (AskUserQuestion with the recommended option first). If the evidence is contradictory or absent, do not guess — ask. Benchmark runs take minutes and switch the checkout; a wrong mode wastes both.

Step 2 — Run the confirmed mode

Every make bench appends records to ~/Library/Logs/Prowl/measurements/bench/bench.jsonl keyed by git rev-parse --short HEAD. Record the exact SHA before each run so the comparison step can find its rows.

hot-path — A/B against the merge-base

  1. Check whether the baseline already exists on this machine: jq -c "select(.gitSHA == \"<base-short-sha>\")" bench.jsonl. Reuse it if present.
  2. If absent: git switch --detach $BASE → make bench → git switch -. The first optimized build after a switch takes minutes; later ones are incremental.
  3. make bench on the branch HEAD.
  4. Compare per Step 3.

new-optimization — pin the claim before measuring it

  1. Check the Reference inventory: does any suite already cover the optimized path?
  2. If not, the primary deliverable is a new benchmark following the 057 pattern, in the same PR as the optimization:
    • dig the replaced implementation out of git history and keep it verbatim as the reference;
    • assert output equivalence before timing;
    • assert a floor ratio 2–4x below the measured Release ratio;
    • gate Swift-vs-Swift ratios on optimized builds (BenchmarkMeasurement.isOptimizedBuild); C-call/filesystem ratios assert everywhere.
  3. Then run the hot-path A/B: the new suite quantifies the win, the existing suites catch collateral damage.
  4. The measured ratio goes into the report as the claim's durable evidence — this is exactly what the #644–#665 wave lacked.

release — full sweep plus series

  1. make test — the behavioral + ratio layer (Debug).
  2. make bench — compare against the trailing series (last ~5 records per case across recent SHAs), not a single baseline.
  3. Live layer, best-effort, report each as run/inconclusive/skipped:
    • make measure-titles — needs a running app with at least one animating agent tab; exit 3 means nothing was animating (inconclusive, not a pass).
    • make measure-cpu — needs a running Prowl Debug instance; set PROWL_PID when several run. Records agent mix and load next to the attribution, so quote them together.
  4. make capture-spike is a standing watch for long-running instances, not a step here; mention it if the user is chasing an intermittent spike.

Step 3 — Compare and judge

Extract both sides:

bash
jq -r 'select(.gitSHA == "SHA") | [.suite, .name, .referenceMilliseconds, .shippedMilliseconds, .ratio] | @tsv' \
  ~/Library/Logs/Prowl/measurements/bench/bench.jsonl

Judgment rubric (single machine, warm cache, medians of 15):

  • A ratio below its asserted floor already failed the test — confirmed regression, no further interpretation needed.
  • shippedMilliseconds against baseline: within ±20% is noise; 1.2–1.5x growth is a watch — rerun make bench once to confirm before claiming anything; above 1.5x sustained is a regression; above 2x is major. Name suspect commits via the file→suite map.
  • Use referenceMilliseconds as the built-in host canary: the reference workload never changes, so if it moved by a similar factor the host moved, not the code; if shipped moved alone, the code moved.
  • Never average across load regimes. If load was elevated during a run, discard the run and redo it — do not "correct" the numbers.

Step 4 — Persistent report

Write a markdown report to ~/Library/Logs/Prowl/measurements/reports/$(date +%Y%m%d-%H%M)-<branch-or-tag>.md (mkdir -p the directory; it lives with the rest of the measurement home, survives reboots, and is never cleaned by the system). Reports are append-only history — never overwrite or delete earlier ones.

Required sections:

  • Intent — the mode the user confirmed, in one line.
  • Context — date, branch, baseline and branch SHAs, load average and core count at run time, app/agent state if the live layer ran.
  • Results — one table per layer: case, baseline shipped ms, branch shipped ms, delta, ratio vs floor.
  • Verdict — no-regression / watch / regression / major, with suspect commits for anything above noise, and the host-canary observation.
  • Not run — layers skipped or inconclusive, and why.
  • Raw refs — the bench.jsonl SHAs and any script run directories.

Reply to the user with the verdict and the report path. The report, not the chat, is the durable record.

Reference

Benchmark inventory (all under App/Tests/, suite root PerformanceBenchmarks):

Suite / checkPinsFloorAsserts in
LineCountScanBenchmarks sparse#644/#652 memchr scan vs Data.reduce3xall builds
LineCountScanBenchmarks all-newline#652 hybrid dense fallback2xoptimized only
FingerprintNormalizeBenchmarks#650/#657 escape-absence guard1.3xoptimized only
WorktreeDirectoryIndexBenchmarks#648/#655 index vs per-row scan2xall builds
SessionScoringBenchmarks#650/#657 warm fragment cache3xall builds
make measure-titles (live)#649/#656 title coalescing ≤ ~1/s1.25/srunning app

File → suite map for intent classification and suspect naming:

Changed pathAffected check
App/Sources/Clients/Git/GitClient.swift, UntrackedLineCountCache.swiftLineCountScan
App/Sources/Infrastructure/AgentDetection/AgentSessionResolver.swiftFingerprintNormalize, SessionScoring
App/Sources/Domain/WorktreeDirectoryIndex.swift, App/Sources/Support/PathPolicy.swiftWorktreeDirectoryIndex
App/Sources/Features/Terminal/Models/TerminalTabManager.swift, WorktreeTerminalState+AgentDetection.swiftmeasure-titles, coalescing/dedup unit tests
Sidebar / Active Agents views and reducerscounting tests only (no timing suite)

Caveats:

  • referenceMilliseconds values measured inside the Release test bundle are not comparable to standalone -O binaries (~10x apart for Data.reduce); ratios are unaffected. Compare bench.jsonl rows only with other bench.jsonl rows.
  • The suite is .serialized and make bench disables parallel testing and pins the destination arch deliberately — do not "speed it up" by removing either.
  • bench.jsonl is append-only; the same SHA can have several rows (reruns). Prefer the newest row per (suite, name, SHA) and note reruns in the report.

常见问题

Run Benchmark AI 技能有什么作用?

运行 Prowl 的性能基准测试层,对比当前分支或某个版本与已记录的基线,并生成持久保存在本地的报告。仅当用户明确调用 run-benchmark,或明确要求运行性能基准测试/验证性能影响时使用。实现工作完成后不要自动调用。先判断用户的意图属于热路径变更、新优化,还是版本级全面测试,并与用户确认后,再运行相应的测试层。

为什么在 TypingMind 中使用 Run Benchmark?

因为您只需安装一次,就能搭配任何模型使用。Run Benchmark 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Run Benchmark?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/onevcat/Prowl/tree/main/.claude/skills/run-benchmark。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Run Benchmark?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Run Benchmark 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Run Benchmark 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Run Benchmark AI 技能免费吗?

onevcat 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇