How to benchmark a .NET application using BenchmarkDotNet

preview_player
Показать описание
BenchmarkDotNet NuGet package provides a simple and easy-to-understand implement benchmarking mechanism.

#csharp #csharp11 #dotnet #dotnet7 #benchmark

Some of my popular videos:

Рекомендации по теме
Комментарии
Автор

I really like the fact that you created a sepatare class (BenchmarkExecutor.cs) to avoid cluttering Calculator.cs with [Benchmark] attributes.

But assuming Calculator.cs had some further dependencies, e.g. some interfaces to some services, repositories or whatever:
how would you be able to inject these dependencies when you create Calculator-Instance in BenchmarkExecutor.cs ?

I tried to use .NET Core's dependency injection but it looks as if it doesn't work when using BenchmarkDotNet.

BandieraRossa
welcome to shbcf.ru