microbenchmarking
适合需要精确性能度量的开发者,避免常见基准陷阱。
围绕 BenchmarkDotNet 编写、配置与运行 .NET 微基准的指导规范。
用 BenchmarkDotNet(BDN)帮你精确测小段 .NET 代码的执行速度和内存开销,适合需要量化微观性能差异的时候。会教你怎么设计微基准、配置 BDN 的 Job/Runtime、搭建项目并高效运行对比测试。特别在于能做可复现的“逐项对比”测量,别用它做性能剖析(profiling)或压力测试。
▸ 展开 SKILL.md 英文原文
Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling/tracing .NET code (dotnet-trace, PerfView), production telemetry, or load/stress testing (Crank, k6).
帮我安装这个 skill:https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-diag/skills/microbenchmarking/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/dotnet/skills/main/plugins/dotnet-diag/skills/microbenchmarking/SKILL.md"# Benchmark Authoring Guidelines BenchmarkDotNet (BDN) is a .NET library for writing and running microbenchmarks. Throughout this skill, "BDN" refers to BenchmarkDotNet. > **Note:** Evaluations of LLMs writing BenchmarkDotNet benchmarks have revealed common failure patterns caused by outdated assumptions about BDN's behavior — particularly around runtime comparison, job configuration, and execution defaults that have changed in recent versions. The reference files in this skill contain verified, current information. **You MUST read the reference files relevant to the task before writing any code** — your training data likely contains outdated or incorrect BDN patterns. ## Key concepts -