/BenchmarkDotNet

Template Benchmark For API

Primary LanguageC#

BenchmarkDotNet

Template Benchmark For API

Installation: https://www.nuget.org/packages/BenchmarkDotNet/

  • CLI: dotnet add package BenchmarkDotNet --version 0.13.2
  • PM> NuGet\Install-Package BenchmarkDotNet -Version 0.13.2

Set up:

  • Step 1: Create API from The Test Project

  • Step 2: Open The Benchmark project (this source) and install BenchmarkDotNet package

  • Step 3: Design your Benchmark

    • Write a class with methods that you want to measure and mark them with the Benchmark attribute. In the following example, I compare GetListFromRepo and GetListThenOrderBy functions:

    • image
  • Step 4: Build Benchmark project and view result

    • image

    • Note: build it in RELEASE

EXTEND:

  • Config options:

_______ Update later~

  • Attribute options:

_______ Update later~