Closed swtrse closed 2 months ago
Add a const int OpCount = 100_000;
Run the work in a loop for (int i = 0; i < OpCount; ++i)
.
Attribute your benchmark like this [Benchmark(OperationsPerInvoke = OpCount)]
.
Adjust OpCount
value until the warning goes away.
If necessary, group your setup data into an array the size of OpCount
, and loop to fill it in the [IterationSetup]
.
A sample benchmark that does what @timcassell has described: https://github.com/dotnet/performance/blob/main/src/benchmarks/micro/libraries/System.Collections/Sort.cs
thx that's what I was looking for. @timcassell I guess OperationsPerInvoke will calculate it down to time of one operation. Am I right?
I guess OperationsPerInvoke will calculate it down to time of one operation. Am I right?
Yes, the results will be scaled.
Hello,
I have a Benchmark that looks like
What I want to compare is the performance between the different variants. However I get the MinIterationTime warning. Since my time is far away from the needed minimum iteration time I think I need to rewrite the tests but I have absolutely no idea how to do that and achieve the same tests. What I do not want is to add the time to prepare the collection to the performance benchmark time.