Skip to content

NBenchmark

NBenchmark is a lightweight benchmarking library for .NET. It is designed around three principles:

  • Excellent developer experience. Go from nothing to your first measurement in one line of code.
  • High performance. No reflection overhead in the measurement loop, accurate timers, proper GC handling.
  • Statistically honest output. Confidence intervals, outlier trimming, and a non-parametric significance test are on by default so you know whether a difference is real.

Packages

PackageDescription
NBenchmarkThe zero-dependency core. All measurement, statistics, and file reporters.
NBenchmark.ConsoleAdds a rich terminal table and progress display via Spectre.Console.
NBenchmark.DependencyInjectionOptional integration that lets [Benchmark] classes have constructor dependencies resolved from an IServiceProvider.
NBenchmark.AnalyzersRoslyn analyzers that catch common configuration errors at compile time. See the Analyzers page for the full diagnostic list.

Pick a starting point

Not sure where to begin? Start here:

Already comfortable with the basics?

Released under the MIT License.