Skip to content

perf: skip the failure texts of a met InAnyOrder().IgnoringDuplicates() - #1789

Merged
vbreuss merged 1 commit into
mainfrom
perf/any-order-ignoring-duplicates-met-path
Oct 11, 2026
Merged

vbreuss merged 1 commit into
mainfrom
perf/any-order-ignoring-duplicates-met-path

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 11, 2026

Copy link
Copy Markdown
Member

The matcher that ignores duplicates in any order created the item formatter and the error list at the end of every evaluation, although a met expectation has no deviation to report. It now returns early like the matcher that keeps duplicates.

| Benchmark (4 items, 3 expected) | Before | After | |---|---:|---:|
| IsEqualTo(expected).InAnyOrder().IgnoringDuplicates() | 1.534 µs / 2.06 KB | 1.260 µs / 1.54 KB | | Contains(expected).InAnyOrder().IgnoringDuplicates() | 1.620 µs / 1.95 KB | 1.381 µs / 1.54 KB |

…s()`

The matcher that ignores duplicates in any order created the item formatter and the error list at the end of every evaluation, although a met expectation has no deviation to report. It now returns early like the matcher that keeps duplicates.

| Benchmark (4 items, 3 expected) | Before | After |
|---|---:|---:|
| `IsEqualTo(expected).InAnyOrder().IgnoringDuplicates()` | 1.534 µs / 2.06 KB | 1.260 µs / 1.54 KB |
| `Contains(expected).InAnyOrder().IgnoringDuplicates()` | 1.620 µs / 1.95 KB | 1.381 µs / 1.54 KB |
@vbreuss vbreuss self-assigned this Oct 11, 2026
@vbreuss
vbreuss enabled auto-merge (squash) October 11, 2026 08:45
@vbreuss
vbreuss disabled auto-merge October 11, 2026 08:51
@vbreuss
vbreuss merged commit c9eb2ce into main Oct 11, 2026
12 checks passed
@vbreuss
vbreuss deleted the perf/any-order-ignoring-duplicates-met-path branch October 11, 2026 08:51
@sonarqubecloud

Copy link
Copy Markdown

github-actions Bot added a commit that referenced this pull request Oct 11, 2026
…InAnyOrder().IgnoringDuplicates()` (#1789) by Valentin Breuß
github-actions Bot added a commit that referenced this pull request Oct 11, 2026
…InAnyOrder().IgnoringDuplicates()` (#1789) by Valentin Breuß
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
AMD EPYC 9V74 3.69GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
[Host] : .NET 8.0.31 (8.0.31, 8.0.3126.42015), X64 RyuJIT x86-64-v4

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean vs aweXpect Error StdDev Gen0 Gen1 Allocated vs aweXpect
Bool_aweXpect 117.8 ns 2.78 ns 2.46 ns 0.0262 - 440 B
Bool_FluentAssertions 211.8 ns +80% 1.46 ns 1.29 ns 0.0567 - 952 B +116%
Bool_TUnit 172.1 ns +46% 2.13 ns 1.99 ns 0.0281 - 472 B +7%
Equivalency_aweXpect 81,234.0 ns 73.06 ns 68.34 ns 0.9766 - 16440 B
Equivalency_FluentAssertions 1,981,690.1 ns +2339% 33,540.81 ns 31,374.09 ns 289.0625 42.9688 4841648 B +29350%
Equivalency_TUnit 165,927.5 ns +104% 6,106.45 ns 5,711.98 ns 9.2773 0.4883 155992 B +849%
EventTriggered_aweXpect 544.7 ns 7.42 ns 6.58 ns 0.1097 - 1840 B
EventTriggered_FluentAssertions 51,905.0 ns +9428% 1,051.84 ns 932.43 ns 0.3052 0.2441 5256 B +186%
Int_GreaterThan_aweXpect 119.9 ns 0.66 ns 0.58 ns 0.0324 - 544 B
Int_GreaterThan_FluentAssertions 207.5 ns +73% 1.00 ns 0.84 ns 0.0730 - 1224 B +125%
Int_GreaterThan_TUnit 180.2 ns +50% 1.31 ns 1.23 ns 0.0463 - 776 B +43%
ItemsCount_AtLeast_aweXpect 212.3 ns 0.71 ns 0.67 ns 0.0377 - 632 B
ItemsCount_AtLeast_FluentAssertions 399.6 ns +88% 7.33 ns 6.86 ns 0.1197 - 2008 B +218%
ItemsCount_AtLeast_TUnit 294.2 ns +39% 3.67 ns 3.43 ns 0.0634 - 1064 B +68%
Satisfies_aweXpect 146.5 ns 1.05 ns 0.93 ns 0.0348 - 584 B
Satisfies_FluentAssertions 14,782.2 ns +9991% 410.34 ns 383.84 ns 0.3357 0.2899 5615 B +861%
Satisfies_TUnit 180.2 ns +23% 0.73 ns 0.69 ns 0.0424 - 712 B +22%
String_aweXpect 205.8 ns 2.77 ns 2.59 ns 0.0362 - 608 B
String_FluentAssertions 936.5 ns +355% 13.92 ns 12.34 ns 0.2356 0.0010 3944 B +549%
String_TUnit 244.8 ns +19% 1.85 ns 1.73 ns 0.0544 - 912 B +50%
StringArray_aweXpect 466.2 ns 1.69 ns 1.58 ns 0.0534 - 896 B
StringArray_FluentAssertions 1,081.0 ns +132% 20.48 ns 17.10 ns 0.2480 - 4152 B +363%
StringArray_TUnit 493.9 ns +6% 9.99 ns 9.35 ns 0.0753 - 1264 B +41%
StringArrayInAnyOrder_aweXpect 747.8 ns 3.03 ns 2.69 ns 0.0772 - 1304 B
StringArrayInAnyOrder_FluentAssertions 15,690.3 ns +1998% 69.46 ns 64.97 ns 1.9836 0.0610 33471 B +2467%
StringArrayInAnyOrder_TUnit 568.8 ns -24% 2.60 ns 2.18 ns 0.0839 - 1408 B +8%

@github-actions

Copy link
Copy Markdown
Contributor

This is addressed in release v3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant