Skip to content

Instantly share code, notes, and snippets.

@adamsitnik
Created September 10, 2018 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamsitnik/77df3a41d18eedb2aceb589e43ed7263 to your computer and use it in GitHub Desktop.
Save adamsitnik/77df3a41d18eedb2aceb589e43ed7263 to your computer and use it in GitHub Desktop.
summaryJoinOrderBy
using System;
using System.Linq;
using System.Threading;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Running;
namespace BenchmarkDotNet.Samples
{
class Program
{
static void Main(string[] args)
=> BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args,
DefaultConfig.Instance
.With(Job.ShortRun)
.With(new DefaultOrderer(SummaryOrderPolicy.FastestToSlowest)));
}
public class Sleepc { [Benchmark] public void TenMs() => Thread.Sleep(TimeSpan.FromMilliseconds(10)); }
public class Sleepb { [Benchmark] public void HoundredMs() => Thread.Sleep(TimeSpan.FromMilliseconds(100)); }
public class Sleepa { [Benchmark] public void ThousandMs() => Thread.Sleep(TimeSpan.FromMilliseconds(1000)); }
}
dotnet run -c Release -f net46 -- -f BenchmarkDotNet.Samples.Sleep* --join
Type Method Mean Error StdDev
Sleepc TenMs 14.41 ms 24.05 ms 1.359 ms
Sleepb HoundredMs 106.27 ms 53.07 ms 2.999 ms
Sleepa ThousandMs 1,006.44 ms 117.93 ms 6.663 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment