Repository navigation
perf: add Which continuations without closures - #1791
Merged
Merged
Conversation
Every `ForWhich`, e.g. behind `Throws<T>()`, `HasSingle().Which` or `DoesNotThrow().WhoseResult`, allocated two closures and two delegates to create the which node in place of the right-most operand, and `Throws<T>()` added a closure over the exception type for its accessor. The which node is now created from a state with a static lambda, and `Throws<T>()` shares one accessor per exception type. | Benchmark | Before | After | |---|---:|---:| | `DoesNotThrow().WhoseResult.IsEqualTo(42)` | 771.8 ns / 1.48 KB | 726.0 ns / 1.27 KB | | `HasSingle().Which.IsEqualTo(42)` | 522.8 ns / 1.27 KB | 522.7 ns / 1.05 KB | | `Throws<InvalidOperationException>()` | 6609.4 ns / 1.96 KB | 6564.5 ns / 1.66 KB |
vbreuss
enabled auto-merge (squash)
October 11, 2026 09:01
|
Contributor
Test Results 91 files 91 suites 1h 59m 48s ⏱️ Results for commit feefb46. |
Contributor
🚀 Benchmark ResultsDetails
|
github-actions Bot
added a commit
that referenced
this pull request
Oct 11, 2026
… closures (#1791) by Valentin Breuß
github-actions Bot
added a commit
that referenced
this pull request
Oct 11, 2026
… closures (#1791) 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.



Every
ForWhich, e.g. behindThrows<T>(),HasSingle().WhichorDoesNotThrow().WhoseResult, allocated two closures and two delegates to create the which node in place of the right-most operand, andThrows<T>()added a closure over the exception type for its accessor. The which node is now created from a state with a static lambda, andThrows<T>()shares one accessor per exception type.DoesNotThrow().WhoseResult.IsEqualTo(42)