Logo Run Benchmark

Run Benchmark

Cộng đồng
onevcat
run-benchmark

Chạy các lớp kiểm thử hiệu năng của Prowl cho nhánh hiện tại hoặc một bản phát hành, so sánh với các mốc chuẩn đã ghi nhận và lưu báo cáo cục bộ lâu dài. Chỉ dùng khi người dùng chủ động gọi run-benchmark hoặc yêu cầu chạy kiểm thử hiệu năng / xác minh tác động đến hiệu năng. Không tự động chạy sau khi hoàn tất công việc triển khai. Trước tiên, phân loại ý định của người dùng (thay đổi đường chạy thường xuyên, tối ưu hóa mới hay kiểm tra toàn diện ở cấp bản phát hành), xác nhận với người dùng, rồi chạy các lớp kiểm thử phù hợp.

Add to TypingMind

Tổng quan

Nhà phát hànhonevcat
Kho mãProwl
Tên kỹ năngrun-benchmark
Sao
647
Bản fork
66
Tệp đi kèm
Chỉ có hướng dẫn
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được onevcat công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Run Benchmark trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/onevcat/Prowl/tree/main/.claude/skills/run-benchmark
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Run Benchmark trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Run Benchmark ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Run Benchmark với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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.

Câu hỏi thường gặp

Kỹ năng AI Run Benchmark làm được gì?

Chạy các lớp kiểm thử hiệu năng của Prowl cho nhánh hiện tại hoặc một bản phát hành, so sánh với các mốc chuẩn đã ghi nhận và lưu báo cáo cục bộ lâu dài. Chỉ dùng khi người dùng chủ động gọi run-benchmark hoặc yêu cầu chạy kiểm thử hiệu năng / xác minh tác động đến hiệu năng. Không tự động chạy sau khi hoàn tất công việc triển khai. Trước tiên, phân loại ý định của người dùng (thay đổi đường chạy thường xuyên, tối ưu hóa mới hay kiểm tra toàn diện ở cấp bản phát hành), xác nhận với người dùng, rồi chạy các lớp kiểm thử phù hợp.

Vì sao nên dùng Run Benchmark trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Run Benchmark là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Run Benchmark trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/onevcat/Prowl/tree/main/.claude/skills/run-benchmark. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Run Benchmark?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Run Benchmark với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Run Benchmark với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Run Benchmark có miễn phí không?

Kỹ năng này được onevcat phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇