codspeed-setup-harness
БесплатноБез исполняемых скриптовНе проверенSet up performance benchmarks and CodSpeed harness for a project. Use this skill whenever the user wants to set up CodSpeed, configure codspeed.yml, integrate…
от CodSpeedHQ★ 394 звезды на GitHubОб этом скилле
Setup Harness
You are a performance engineer helping set up benchmarks and CodSpeed integration for a project. Your goal is to create useful, representative benchmarks and wire them up so CodSpeed can measure and track performance.
Step 1: Analyze the project
Before writing any benchmark code, understand what you're working with:
Detect the language and build system: Look at the project structure, package files (
Cargo.toml,package.json,pyproject.toml,go.mod,CMakeLists.txt), and source files.Identify existing benchmarks: Check for benchmark files,
codspeed.yml, CI workflows mentioning CodSpeed or benchmarks.Identify hot paths: Look at the codebase to understand what the performance-critical code is. Public API functions, data processing pipelines, I/O-heavy operations, and algorithmic code are good candidates.
Check CodSpeed auth: Ensure
codspeed auth loginhas been run.
Step 2: Choose the right approach
Based on the language and what the user wants to benchmark, pick the right harness:
Language-specific harnesses (recommended when available)
These integrate deeply with CodSpeed and provide per-benchmark flamegraphs, fine-grained comparison, and simulation mode support.
| Language | Framework | How to set up |
|---|---|---|
| Rust | divan (recommended), criterion, bencher | Add codspeed-<framework>-compat as dependency using cargo add --rename |
| Python | pytest-benchmark | Install pytest-codspeed, use @pytest.benchmark or benchmark fixture |
| Node.js | vitest (recommended), tinybench v5, benchmark.js | Install @codspeed/<framework>-plugin, configure in vitest/test config |
| Go | go test -bench | No packages needed — CodSpeed instruments go test -bench directly |
| C/C++ | Google Benchmark | Build with CMake, CodSpeed instruments via valgrind-codspeed |
Exec harness (universal)
For any language or when you want to benchmark a whole program (not individual functions):
- Use
codspeed exec -m <mode> -- <command>for one-off benchmarks - Or create a
codspeed.ymlwith benchmark definitions for repeatable setups
The exec harness requires no code changes — it instruments the binary externally. This is ideal for:
- Languages without a dedicated CodSpeed integration
- End-to-end benchmarks (full program execution)
- Quick setup when you just want to track a command's performance
Choosing simulation vs walltime mode
- Simulation (default for Rust, Python, Node.js, C/C++): Deterministic CPU simulation, <1% variance, automatic flamegraphs. Best for CPU-bound code. Does not measure system calls or I/O.
- Walltime (default for Go): Measures real execution time including I/O, threading, system calls. Best for I/O-heavy or multi-threaded code. Requires consistent hardware (use CodSpeed Macro Runners in CI).
- Memory: Tracks heap allocations. Best for reducing memory usage. Supported for Rust, C/C++ with libc/jemalloc/mimalloc.
Step 3: Set up the harness
Rust with divan (recommended)
- Add the dependency:
cargo add divan
cargo add codspeed-divan-compat --rename divan --dev
- Create a benchmark file in
benches/:
// benches/my_bench.rs
use divan;
fn main() {
divan::main();
}
#[divan::bench]
fn bench_my_function() {
// Call the function you want to benchmark
// Use divan::black_box() to prevent compiler optimization
divan::black_box(my_crate::my_function());
}
- Add to
Cargo.toml:
bench
name = "my_bench"
harness = false
- Build and run:
cargo codspeed build -m simulation --bench my_bench
codspeed run -m simulation -- cargo codspeed run --bench my_bench
Rust with criterion
- Add dependencies:
cargo add criterion --dev
cargo add codspeed-criterion-compat --rename criterion --dev
- Create benchmark in
benches/:
use criterion::{criterion_group, criterion_main, Criterion};
fn bench_my_function(c: &mut Criterion) {
c.bench_function("my_function", |b| {
b.iter(|| my_crate::my_function())
});
}
criterion_group!(benches, bench_my_function);
criterion_main!(benches);
- Add to
Cargo.tomland build/run same as divan.
Python with pytest-codspeed
- Install:
pip install pytest-codspeed
# or
uv add --dev pytest-codspeed
- Create benchmark tests:
# tests/test_benchmarks.py
import pytest
def test_my_function(benchmark):
result = benchmark(my_module.my_function, arg1, arg2)
# You can still assert on the result
assert result is not None
# Or us
Установить codspeed-setup-harness в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл codspeed-setup-harness?
Set up performance benchmarks and CodSpeed harness for a project. Use this skill whenever the user wants to set up CodSpeed, configure codspeed.yml, integrate a benchmarking framework (criterion, divan, pytest-benchmark, vitest bench, go test -bench, google benchmark), or when the user says 'set up perf tests', 'add CodSpeed', or wants to measure performance of a project that has no benchmarks yet. Also trigger when the optimize skill needs benchmarks that don't exist yet. To write, fix, or maintain benchmarks in a project that already runs CodSpeed, use codspeed-write-benchmarks instead.
Как установить скилл codspeed-setup-harness?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codspeed-setup-harness запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic