Added Benchmark for SpanHelpers.Contains {byte, char} #2347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cf. dotnet/runtime#67492 (comment)
I created a new file for this benchmark, as the current benchmarks for
Span
didn't fit here really well -- though I'm not sure if my benchmarks here are over-engineered.For e.g.
SpanHelpers.IndexOf
there is a benchmark (performance/src/benchmarks/micro/libraries/System.Memory/Span.cs
Line 69 in a37c8e3
At least for the PR dotnet/runtime#67492 I covered these cases, but the execution time for the benchmarks rises.
So I'm not sure what's the right balance here. Especially if we take ARM also into account, then there maybe different cut-offs for the edge-cases making the combinations grow up.
On one hand I think the benchmark should cover edge-cases -- here the perf-critical ones -- too, but on the other hand they should give an good enough estimate on how well the code is performing.
PS: If this should be discussed in an issue rather than this PR here, please create an issue, edit this PR, whatever is best.