dotnet / dotnet/BenchmarkDotNet

Dynamically define `InvocationCount`/ `MaxInvocationCount` etc.

Open
#1,402 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
6d 11h
Merged PRs (30d)
12

Description

I have a lot of benchmarks that depend a lot on the actual parameters being tested and where I want to define the `InvocationCount` or `MaxInvocationCount` **depending** on the parameters currently being benchmarked. Sadly, most of BDNs parameters are static, is there or could there be a way to "dynamically" define these in the benchmark class itself, that is in code e.g. a property `int MaxInvocationCount => /* some benchmark specific code */;`, that is then called after parameters are set but before actual benchmark is run. Hence allowing to fully control these "run counts" based on the benchmark being run.

As an example I could point to `Sort` in dotnet/performance, which have issues around that.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.