NBench 0.3.0

NBench is a cross-platform automated performance profiling and testing framework for.NET applications.

There is a newer version of this package available.
See the version list below for details.
Install-Package NBench -Version 0.3.0
dotnet add package NBench --version 0.3.0
<PackageReference Include="NBench" Version="0.3.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NBench --version 0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NBench, 0.3.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NBench as a Cake Addin
#addin nuget:?package=NBench&version=0.3.0

// Install NBench as a Cake Tool
#tool nuget:?package=NBench&version=0.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

This release introduces some breaking changes to NBench:
Tracing**
The biggest feature included in this release is the addition of tracing support, which is exposed directly to end-users so they can capture trace events and include them in the output produced by NBench.
You can access the `IBenchmarkTrace` object through the `BenchmarkContext` passed into any of your `PerfSetup`, `PerfBenchmark`, or `PerfCleanup` methods like such:
```csharp
public class TracingBenchmark
{
[PerfSetup]
public void Setup(BenchmarkContext context)
{
context.Trace.Debug(SetupTrace);
}
[PerfBenchmark(TestMode = TestMode.Test, NumberOfIterations = IterationCount, RunTimeMilliseconds = 1000)]
[MemoryMeasurement(MemoryMetric.TotalBytesAllocated)]
[MemoryAssertion(MemoryMetric.TotalBytesAllocated, MustBe.LessThan, ByteConstants.EightKb)]
public void Run1(BenchmarkContext context)
{
context.Trace.Debug(RunTrace);
}
[PerfCleanup]
public void Cleanup(BenchmarkContext context)
{
context.Trace.Info(CleanupTrace);
}
}
```
`NBench.Runner.exe` now takes a `trace=true|false` commandline argument, which will enable the new tracing feature introduced in this release.
Tracing is disabled by default**.
Skippable Warmups**
You can now elect to skip warmups altogether for your specs. This feature is particularly useful for long-running iteration benchmarks, which are often used for stress tests. Warmups don't add any value here.
Here's how you can skip warmups:
```csharp
[PerfBenchmark(TestMode = TestMode.Test, NumberOfIterations = IterationCount, RunTimeMilliseconds = 1000, SkipWarmups = true)]
[MemoryMeasurement(MemoryMetric.TotalBytesAllocated)]
[MemoryAssertion(MemoryMetric.TotalBytesAllocated, MustBe.LessThan, ByteConstants.EightKb)]
public void Run1(BenchmarkContext context)
{
context.Trace.Debug(RunTrace);
}
```
Just set `SkipWarmups = true` on your `PerfBenchmark` attribute wherever you wish to skip a warmup.
Foreground thread is no longer given high priority when concurrent mode is on**.
If you are running the `NBench.Runner` with `concurrent=true`, we no longer give the main foreground thread high priority as this resulted in some unfair scheduling during concurrent tests. All threads within the `NBench.Runner` process all share the same priority now.
Markdown reports include additional data**
All markdown reports now include:
The concurrency setting for NBench
The tracing setting for NBench
A flag indicating if warmups were skipped or not
All of these were added in order to make it easy for end-users reading the reports to know what the NBench settings were at the time the report was produced.

Dependencies

This package has no dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on NBench:

Package Downloads
Pro.NBench.xUnit
Allows NBench tests to be discovered, executed, reported, and debugged using xUnit in ReSharper, and Visual Studio Test Explorer. Please refer to the project Url for usage information: https://github.com/Pro-Coded/Pro.NBench.xUnit
NBench.PerformanceCounters
Windows only. Adds performance counter support to NBench measurements.
NBench.Runner.DotNetCli
Cross-platform performance benchmarking and testing framework for .NET applications.
NBench-PerfAssert
Package Description

GitHub repositories (7)

Showing the top 5 popular GitHub repositories that depend on NBench:

Repository Stars
akkadotnet/akka.net
Port of Akka actors for .NET
Azure/DotNetty
DotNetty project – a port of netty, event-driven asynchronous network application framework
RicoSuter/NJsonSchema
JSON Schema reader, generator and validator for .NET
SonarSource/sonar-dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
helios-io/helios
reactive socket middleware for .NET

Version History

Version Downloads Last updated
2.0.1 76,358 2/25/2020
2.0.0 349 2/24/2020
1.2.2 105,256 7/24/2018
1.2.1 1,856 7/11/2018
1.2.0 676 7/10/2018
1.1.0 4,584 7/2/2018
1.0.4 116,098 6/16/2017
1.0.3 903 6/11/2017
1.0.2 859 6/2/2017
1.0.1 22,451 3/31/2017
1.0.0 3,509 3/15/2017
0.3.4 31,662 12/16/2016
0.3.3 1,073 12/8/2016
0.3.2 792 12/8/2016
0.3.1 10,498 8/16/2016
0.3.0 7,203 5/24/2016
0.2.2 1,966 5/3/2016
0.2.1 2,037 4/7/2016
0.2.0 781 4/6/2016
0.1.6 1,321 2/15/2016
0.1.5 12,161 12/10/2015
0.1.4 764 12/10/2015
0.1.3 762 12/8/2015
0.1.2 728 12/8/2015
0.1.1 738 12/7/2015
0.1.0 805 12/4/2015
0.0.2 777 12/4/2015
Show less