How to benchmark a .NET application using BenchmarkDotNet
Вставка
- Опубліковано 3 чер 2023
- BenchmarkDotNet NuGet package provides a simple and easy-to-understand implement benchmarking mechanism.
#csharp #csharp11 #dotnet #dotnet7 #benchmark
Some of my popular videos:
Elasticsearch with .NET and introduction: • An Introduction to Ela...
Hangfire Scheduling an introduction: • Scheduling recurring j...
ASP.NET Core Authentication with JWT (JSON Web Token): • ASP.NET Core Authentic...
Running Background tasks using IHostedService and BackgroundService (In ASP.NET Core 3.1): • Running Background tas...
How to build an API Gateway in ASP.NET Core using Ocelot (Build API Gateway in a few minutes): • How to build an API Ga...
My blog site: dotnetcorecentral.com - Наука та технологія
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.
awesoam