AgentSkillsCN

bench-fast

通过 BenchmarkDotNet 的 DisassemblyDiagnoser,以极小的迭代次数运行基准测试,生成汇编代码。适用于为每个基准测试生成一份大型汇编代码文件。

SKILL.md
--- frontmatter
name: bench-fast
description: Run a benchmark with minimal iterations to generate assembly code via BenchmarkDotNet's DisassemblyDiagnoser. Use to generate one big assembly code file per benchmark.

Usage

code
/bench-fast <BenchmarkName> [<Runtimes>]

Arguments

  • $ARGUMENTS - The name of the benchmark class to run (e.g., LruJustGetOrAdd, LfuJustGetOrAdd, SketchIncrement), optionally followed by a list of one or more runtimes (e.g., net48, net9.0 or net48 net9.0)

Instructions

Run the specified benchmark from BitFaster.Caching.Benchmarks with minimal iterations using BenchmarkDotNet's command line.

Parse the arguments: the first argument is the benchmark name, and the optional second argument is the list of runtimes.

If a runtime arg is specified, execute:

bash
dotnet run -c Release --project BitFaster.Caching.Benchmarks --framework net9.0 -- --runtimes <Runtimes> --filter "<BenchmarkName>" -j short --warmupCount 3 --iterationCount 5 -d --disasmDepth 5

If no runtime is specified, simply omit that command line arg:

bash
dotnet run -c Release --project BitFaster.Caching.Benchmarks --framework net9.0 -- --filter "<BenchmarkName>" -j short --warmupCount 3 --iterationCount 5 -d --disasmDepth 5

The --warmupCount 3 --iterationCount 5 options reduce warmup and iteration counts for faster execution while still executing the code enough times to JIT optimized code.