Repository navigation
perf: count the items of Contains with a string synchronously - #1808
Merged
Merged
Conversation
`Contains` with a string awaited the comparison of every item, although the comparison without an option is ordinal and never needs to be awaited. Such an item is now matched synchronously, once the subject is known not to be a set whose comparer decides instead. Measured in ABBA order (after, before, before, after), the mean of both runs: | Benchmark (`List<string>` of 17 titles) | Before | After | |---|---:|---:| | `Contains` of the first title | 283.3 ns / 696 B | 247.6 ns / 720 B | | `Contains` of the seventh title | 380.3 ns / 696 B | 285.2 ns / 720 B | | `Contains` of the last title | 580.3 ns / 696 B | 386.2 ns / 720 B |
|
Contributor
Test Results 91 files 91 suites 1h 48m 17s ⏱️ Results for commit 7198b71. |
Contributor
🚀 Benchmark ResultsDetails
|
github-actions Bot
added a commit
that referenced
this pull request
Oct 11, 2026
…h a string synchronously (#1808) by Valentin Breuß
github-actions Bot
added a commit
that referenced
this pull request
Oct 11, 2026
…h a string synchronously (#1808) by Valentin Breuß
Contributor
|
This is addressed in release v3.1.0. |
This was referenced Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Containswith a string awaited the comparison of every item, although the comparison without an option is ordinal and never needs to be awaited. Such an item is now matched synchronously, once the subject is known not to be a set whose comparer decides instead.Measured in ABBA order (after, before, before, after), the mean of both runs:
List<string>of 17 titles)Containsof the first title