surface-benchmarker
БесплатноБез исполняемых скриптовНе проверенGuidelines for running and interpreting Surface API performance benchmarks. Use when modifying code in src/Hex1b/Surfaces/ to ensure performance is not…
от mitchdenny★ 186 звёзд на GitHubОб этом скилле
Surface Benchmarker Skill
This skill provides guidelines for AI agents to run and interpret performance benchmarks for the Hex1b Surface API. Run benchmarks whenever you modify code in src/Hex1b/Surfaces/ to ensure performance is not regressed.
Quick Reference
| Action | Command |
|---|---|
| Run all Surface benchmarks | dotnet run -c Release --project benchmarks/Hex1b.Benchmarks -- --filter "Surface*" |
| Run specific benchmark | dotnet run -c Release --project benchmarks/Hex1b.Benchmarks -- --filter "*WriteText*" |
| Quick dry-run (sanity check) | dotnet run -c Release --project benchmarks/Hex1b.Benchmarks -- --filter "Surface*" --job dry |
When to Run Benchmarks
ALWAYS run benchmarks after modifying:
| File/Area | Critical Benchmarks |
|---|---|
SurfaceCell.cs |
All (cells are used everywhere) |
Surface.cs |
CreateSurface_*, WriteText_*, Fill_*, Clone_* |
CompositeSurface.cs |
CompositeSurface_* |
SurfaceComparer.cs |
Compare_*, ToTokens_*, ToAnsiString_* |
SurfaceDiff.cs |
Compare_* |
ComputeContext.cs |
CompositeSurface_* (computed cells use this) |
Benchmark Harness Architecture
Project Structure
benchmarks/Hex1b.Benchmarks/
├── Hex1b.Benchmarks.csproj # Console app with BenchmarkDotNet
├── Program.cs # Entry point
└── SurfaceBenchmarks.cs # Surface API benchmarks
How BenchmarkDotNet Works
BenchmarkDotNet is a .NET performance benchmarking library that:
- Warms up the JIT by running the benchmark multiple times before measuring
- Runs multiple iterations to get statistically significant results
- Reports mean, median, standard deviation for each benchmark
- Tracks memory allocations (when
[MemoryDiagnoser]is enabled)
Benchmark Lifecycle
┌─────────────────────────────────────────────────────────────────┐
│ 1. GlobalSetup │
│ - Runs once before all benchmarks │
│ - Creates pre-allocated surfaces, diffs, etc. │
│ - Sets up shared test data │
└─────────────────────────────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ 2. For each [Benchmark] method: │
│ a. Warmup phase (JIT compilation, cache warming) │
│ b. Pilot phase (determine optimal iteration count) │
│ c. Actual measurements (multiple iterations) │
│ d. Results aggregation │
└─────────────────────────────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ 3. Report Generation │
│ - Console output with statistics │
│ - Optional: HTML, CSV, JSON exports │
└─────────────────────────────────────────────────────────────────┘
Key Benchmark Attributes
| Attribute | Purpose |
|---|---|
[MemoryDiagnoser] |
Reports memory allocations (Gen0/1/2 collections, allocated bytes) |
[Benchmark] |
Marks a method as a benchmark |
[GlobalSetup] |
Runs once before all benchmarks to set up shared state |
[Params(80, 160, 320)] |
Parameterizes benchmarks with multiple values |
Benchmark Categories
Surface Creation (CreateSurface_*)
Measures allocation and initialization cost for surfaces of various sizes.
[Benchmark]
public Surface CreateSurface_Small() => new Surface(80, 24); // Standard terminal
public Surface CreateSurface_Medium() => new Surface(160, 48); // Large terminal
public Surface CreateSurface_Large() => new Surface(320, 96); // Very large
public Surface CreateSurface_4K() => new Surface(480, 135); // 4K equivalent
What to watch for:
- Memory allocation should scale linearly with cell count
- No unexpected allocations from internal data structures
Text Writing (WriteText_*)
Measures grapheme parsing and wide character handling.
[Benchmark]
public void WriteText_Short(); // "Hello"
public void WriteText_Medium(); // Standard sentence
public void WriteText_Long(); // Long paragraph
public void WriteText_WideChars(); // Chinese characters (2 cells each)
public void WriteText_FillScreen(); // 24 lines of text
What to watch for:
- Wide characters should not be drastically slower than ASCII
FillScreenshould scale linearly
Fill Operations (Fill_*)
Measures bulk cell assignment.
[Benchmark]
public void Fill_SmallRect(); // 20x10 region
public void Fill_FullScreen(); // 80x24
public void Fill_LargeScreen(); // 320x96
What to watch for:
- Should approach memory bandwidth limits
Установить surface-benchmarker в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл surface-benchmarker?
Guidelines for running and interpreting Surface API performance benchmarks. Use when modifying code in src/Hex1b/Surfaces/ to ensure performance is not regressed.
Как установить скилл surface-benchmarker?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл surface-benchmarker запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic