Show / Hide Table of Contents

BenchmarkDotNet v0.11.3

Highlights

This release is focused mainly on bug fixes that were affecting user experience. But don't worry, we have some new features too!

  • Diagnosers
    • ConcurrencyVisualizerProfiler (allows profiling benchmarks on Windows and exporting the data to a trace file which can be opened with Concurrency Visualizer)
  • Command-line:
    • --stopOnFirstError: Stops the benchmarks execution on first error. #947
    • --statisticalTest: Performs a Mann–Whitney Statistical Test for identifying regressions and improvements. #960
  • Bug fixes:
    • Dry mode doesn't work because of the ZeroMeasurementHelper #943
    • MannWhitneyTest fails when comparing statistics of different sample size #948 and #950
    • Improve the dynamic loading of Diagnostics package #955
    • BenchmarkRunner.RunUrl throws NRE when Config is not provided #961
    • Don't require the users to do manual installation of TraceEvent when using Diagnostics package #962
    • Stop benchmark after closing application + Flush log after stopping benchmark #963

Diagnosers

ConcurrencyVisualizerProfiler

ConcurrencyVisualizerProfiler allows to profile the benchmarked .NET code on Windows and exports the data to a CVTrace file which can be opened with Concurrency Visualizer.

ConcurrencyVisualizerProfiler uses EtwProfiler to get a .etl file which still can be opened with PerfView or Windows Performance Analyzer. The difference is that it also enables all Task and Thread related ETW Providers and exports a simple xml which can be opened with Visual Studio if you install Concurrency Visualizer plugin

open trace

Utilization

Threads

  • #964 Concurrency Visualizer Profiler Diagnoser (by @adamsitnik)
  • dfb3c89 ConcurrencyVisualizerProfiler diagnoser! (by @adamsitnik)

Command-line

In this release, we have some new command-line arguments!

--stopOnFirstError: Stops the benchmarks execution on first error

When provided, BenchmarkDotNet is going to stop the benchmarks execution on first error.

  • #947 Add option to stop running when the first benchmark fails (by @wojtpl2)

--statisticalTest: Statistical Test

To perform a Mann–Whitney U Test and display the results in a dedicated column you need to provide the Threshold via --statisticalTest. Examples: 5%, 10ms, 100ns, 1s.

Example: run Mann–Whitney U test with relative ratio of 1% for all benchmarks for .NET 4.6 (base), .NET Core 2.0 and .NET Core 2.1.

class Program
{
    static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}

public class MySample
{
    [Benchmark]
    public void Sleep()
    {
#if NETFRAMEWORK
        Thread.Sleep(50);
#elif NETCOREAPP2_0
        Thread.Sleep(45);
#elif NETCOREAPP2_1
        Thread.Sleep(55);
#endif
    }
    
    [Benchmark]
    public void Same() => Thread.Sleep(50);
}
dotnet run -c Release -f netcoreapp2.1 --filter * --runtimes net46 netcoreapp2.0 netcoreapp2.1 --statisticalTest 1%

Note: .NET 4.6 will be our baseline because it was provided as first on the runtimes list.

Method Runtime Toolchain Mean Error StdDev Ratio MannWhitney(1%)
Sleep Clr net46 50.51 ms 0.1833 ms 0.1714 ms 1.00 Base
Sleep Core netcoreapp2.0 45.53 ms 0.1262 ms 0.1181 ms 0.90 Faster
Sleep Core netcoreapp2.1 55.50 ms 0.1217 ms 0.1138 ms 1.10 Slower
Same Clr net46 50.47 ms 0.1795 ms 0.1679 ms 1.00 Base
Same Core netcoreapp2.0 50.55 ms 0.1873 ms 0.1752 ms 1.00 Same
Same Core netcoreapp2.1 50.55 ms 0.2162 ms 0.2022 ms 1.00 Same

Milestone details

In the v0.11.3 scope, 10 issues were resolved and 10 pull requests were merged. This release includes 26 commits by 6 contributors.

Resolved issues (10)

  • #870 Error after adding OperationsPerInvoke (assignee: @AndreyAkinshin)
  • #885 Closing application dot't stop benchmark (assignee: @WojciechNagorski)
  • #933 Investigate hanging SingleBenchmarkCanBeExecutedForMultipleRuntimes test (assignee: @adamsitnik)
  • #939 We need an option to stop running when the first benchmark fails. (assignee: @WojciechNagorski)
  • #943 Dry mode doesn't work because of the ZeroMeasurementHelper (assignee: @AndreyAkinshin)
  • #948 BenchmarkDotNet.Mathematics.StatisticalTesting.MannWhitneyTest.PValueForSmallN(int n, int m, double u) (assignee: @AndreyAkinshin)
  • #950 MannWhitneyTest fails when comparing statistics of different sample size (assignee: @AndreyAkinshin)
  • #955 Improve the dynamic loading of Diagnostics package (assignee: @WojciechNagorski)
  • #961 BenchmarkRunner.RunUrl throws NRE when Config is not provided
  • #964 Concurrency Visualizer Profiler (assignee: @adamsitnik)

Merged pull requests (10)

  • #941 Fix example code (isBaseline -> baseline) (by @PathogenDavid)
  • #944 Fixed typo in IntroTagColumn sample (by @ahmedalejo)
  • #947 Add option to stop running when the first benchmark fails (by @WojciechNagorski)
  • #949 Add printDiff in DisassemblyDiagnoserAttribute (by @WojciechNagorski)
  • #951 Add failing test for #948 (by @WojciechNagorski)
  • #958 Use DependencyContext to load diagnostics assembly (by @WojciechNagorski)
  • #960 Expose StatisticalTestColumn via command line arguments (by @adamsitnik)
  • #962 Don't require the users to do manual installation of TraceEvent when using Diagnostics package (by @WojciechNagorski)
  • #963 Stop benchmark after closing application + Flush log after stopping benchmark. (by @WojciechNagorski)
  • #966 Fix typos in ConfigParser and CommandLineOptions (by @morgan-kn)

Commits (26)

  • d85a7e Postrelease update of v0.11.2 changelog (by @AndreyAkinshin)
  • 8b2015 Fix ZeroMeasurementHelper for dry mode case, fixes #943 (by @AndreyAkinshin)
  • ab8543 Fix example code (#941) (by @PathogenDavid)
  • ec5fb2 Enable default analysers in BenchmarkTestExecutor (see #943) (by @AndreyAkinshin)
  • fb251d Remove [DryJob] from IntroBasic (by @AndreyAkinshin)
  • 1c1bdf Fix another problem in ZeroMeasurementAnalyser (see #943) (by @AndreyAkinshin)
  • 348f87 make sure we prevent from inlining the benchmarks also in the dummy method ge... (by @adamsitnik)
  • 80ecec when the parallel build fails, always try one more time in sequential way, ho... (by @adamsitnik)
  • 042291 set the metrics unit to "Count", they should not be empty /cc @jorive (by @adamsitnik)
  • 5b3657 Fixed typo in IntroTagColumn sample (#944) (by @ahmedalejo)
  • 60ea17 Add printDiff in DisassemblyDiagnoserAttribute (#949) (by @WojciechNagorski)
  • b6e8b1 Add failing test for #948 (#951) (by @WojciechNagorski)
  • 3e9f73 Fix IndexOutOfRangeException in MannWhitneyTest, fixes #948 (by @AndreyAkinshin)
  • 9f33f0 Add option to stop running when the first benchmark fails (#947) (by @WojciechNagorski)
  • 376a97 Improve dynamic assembly loading fixes #955 (by @WojciechNagorski)
  • 7dffd4 Handle another corner case in AdaptiveHistogramBuilder, fixes #870 (by @AndreyAkinshin)
  • dfb3c8 ConcurrencyVisualizerProfiler diagnoser! (by @adamsitnik)
  • 7e7dde Fix NRE in BenchmarkRunner.RunUrl, fixes #961 (by @AndreyAkinshin)
  • 4e6531 Improve diagnostics dll (#962) (by @WojciechNagorski)
  • 6c4a59 Stop benchmark after closing application + Flush log after stopping benchmark... (by @WojciechNagorski)
  • 51a965 Expose StatisticalTestColumn via command line arguments (#960) (by @adamsitnik)
  • ca188d 0.11.3 initial release notes (by @adamsitnik)
  • adde64 Fix typos in ConfigParser and CommandLineOptions (#966) (by @morgan-kn)
  • ab96ab make sure we cleanup the Logger after running the benchmark, otherwise AppDom... (by @adamsitnik)
  • 91362d Update v0.11.3 changelog (by @AndreyAkinshin)
  • e7e4b5 Set library version: 0.11.3 (by @AndreyAkinshin)

Contributors (6)

  • Adam Sitnik (@adamsitnik)
  • Ahmed Aderopo Alejo (@ahmedalejo)
  • Andrey Akinshin (@AndreyAkinshin)
  • David Maas (@PathogenDavid)
  • Irina Ananeva (@morgan-kn)
  • Wojciech Nagórski (@WojciechNagorski)

Thank you very much!

Additional details

Date: November 20, 2018

Milestone: v0.11.3 (List of commits)

NuGet Packages:

  • https://www.nuget.org/packages/BenchmarkDotNet/0.11.3
  • https://www.nuget.org/packages/BenchmarkDotNet.Diagnostics.Windows/0.11.3
  • Improve this Doc
In This Article
Back to top Copyright © 2013–2021 .NET Foundation and contributors