TRUNGTQ

Think Big, Act Small, Fail Fast and Learn Rapidly

NAVIGATION - SEARCH

Package of the week: BenchmarkDotNet

The week in .NET – On .NET on Docker and new Core tooling, Benchmark.NET, Magicka | .NET Blog

http://benchmarkdotnet.org/

When done properly, benchmarking is a great way to guide your engineering choices by comparing multiple solutions to a problem known to cause performance bottlenecks in your applications. There’s a lot of methodology involved if you want to do it right, however, that is both tricky and repetitive. And no, surrounding your code with a Stopwatch won’t cut it.

BenchmarkDotNet makes it very easy to decorate the code that you want to test so it can be discovered, run many times, and measured. BenchmarkDotNet takes care of warmup and cooldown periods as needed, and will compute mean running times and standard deviation for you. It can also generate reports in a variety of formats.

https://github.com/dotnet/BenchmarkDotNet

[Benchmark(Description = "ImageSharp Resize")]
public ImageSharpSize ResizeImageSharp()
{
  ImageSharpImage image = new ImageSharpImage(Width, Height);
  image.Resize(ResizedWidth, ResizedHeight);
  return new ImageSharpSize(ResizedWidth, ResizedHeight);
}



 

 

LINK: https://blogs.msdn.microsoft.com/dotnet/2017/02/07/the-week-in-net-on-net-on-docker-and-new-core-tooling-benchmark-net-magicka/