Skip to content

refactor: check the event filter in a for loop - #1806

Merged
vbreuss merged 1 commit into
mainfrom
refactor/event-filter-for-loop
Oct 11, 2026
Merged

vbreuss merged 1 commit into
mainfrom
refactor/event-filter-for-loop

Conversation

@vbreuss

@vbreuss vbreuss commented Oct 11, 2026

Copy link
Copy Markdown
Member

Sonar asks to replace the foreach loop of the event filter with All, which would bring back the closure per recorded event that #1801 removed. A for loop keeps the filter free of allocations without the finding.

Sonar asks to replace the `foreach` loop of the event filter with `All`, which would bring back the closure per recorded event that #1801 removed. A `for` loop keeps the filter free of allocations without the finding.
@vbreuss vbreuss self-assigned this Oct 11, 2026
@vbreuss
vbreuss merged commit f8a29bb into main Oct 11, 2026
12 checks passed
@vbreuss
vbreuss deleted the refactor/event-filter-for-loop branch October 11, 2026 11:34
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
AMD EPYC 9V45 2.60GHz, 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
Contains_aweXpect 295.99 ns 2.516 ns 2.101 ns 0.0434 - 728 B
Contains_FluentAssertions 196.25 ns -34% 4.200 ns 3.929 ns 0.0961 0.0002 1608 B +121%
Contains_TUnit 202.53 ns -32% 4.365 ns 4.083 ns 0.0505 - 848 B +16%
Equivalency_aweXpect 6,544.59 ns 166.537 ns 155.779 ns 0.2365 - 4032 B
Equivalency_FluentAssertions 165,016.30 ns +2421% 1,601.713 ns 1,419.877 ns 35.1563 1.9531 590288 B +14540%
Equivalency_TUnit 9,578.84 ns +46% 77.128 ns 72.145 ns 0.9308 - 15680 B +289%
EventTriggered_aweXpect 357.81 ns 9.587 ns 8.967 ns 0.1097 - 1840 B
EventTriggered_FluentAssertions 29,502.18 ns +8145% 961.579 ns 852.415 ns 0.3052 0.2747 5256 B +186%
Int_GreaterThan_aweXpect 76.85 ns 0.473 ns 0.369 ns 0.0324 - 544 B
Int_GreaterThan_FluentAssertions 124.57 ns +62% 1.911 ns 1.694 ns 0.0730 - 1224 B +125%
Int_GreaterThan_TUnit 121.02 ns +57% 2.076 ns 1.733 ns 0.0463 - 776 B +43%
ItemsCount_AtLeast_aweXpect 13,011.24 ns 174.769 ns 154.928 ns 0.5646 - 9592 B
ItemsCount_AtLeast_FluentAssertions 872.10 ns -93% 9.985 ns 9.340 ns 0.1192 - 2008 B -79%
ItemsCount_AtLeast_TUnit 891.02 ns -93% 18.729 ns 17.519 ns 0.0629 - 1064 B -89%
Multiple_aweXpect 539.38 ns 8.720 ns 8.157 ns 0.1287 - 2168 B
Multiple_FluentAssertions 983.56 ns +82% 29.408 ns 27.508 ns 0.4025 - 6744 B +211%
Multiple_TUnit 442.66 ns -18% 8.161 ns 7.633 ns 0.1335 - 2240 B +3%
Satisfies_aweXpect 97.34 ns 1.490 ns 1.164 ns 0.0348 - 584 B
Satisfies_FluentAssertions 9,064.05 ns +9212% 114.548 ns 101.544 ns 0.3357 0.2899 5615 B +861%
Satisfies_TUnit 121.59 ns +25% 3.396 ns 3.010 ns 0.0424 - 712 B +22%
String_aweXpect 138.37 ns 1.405 ns 1.173 ns 0.0362 - 608 B
String_FluentAssertions 258.10 ns +87% 3.707 ns 3.286 ns 0.1373 - 2304 B +279%
String_TUnit 176.59 ns +28% 1.686 ns 1.494 ns 0.0544 - 912 B +50%
StringArray_aweXpect 326.65 ns 7.157 ns 6.695 ns 0.0534 - 896 B
StringArray_FluentAssertions 640.04 ns +96% 7.180 ns 5.996 ns 0.2480 - 4152 B +363%
StringArray_TUnit 318.10 ns -3% 6.633 ns 5.880 ns 0.0753 - 1264 B +41%
StringArrayInAnyOrder_aweXpect 545.66 ns 11.962 ns 10.604 ns 0.0772 - 1304 B
StringArrayInAnyOrder_FluentAssertions 9,642.73 ns +1667% 52.782 ns 44.075 ns 1.9989 0.0610 33471 B +2467%
StringArrayInAnyOrder_TUnit 406.58 ns -25% 6.912 ns 5.772 ns 0.0839 - 1408 B +8%
Throws_aweXpect 7,025.12 ns 80.372 ns 71.247 ns 0.1373 - 2360 B
Throws_FluentAssertions 18,894.26 ns +169% 202.213 ns 168.857 ns 1.0986 - 18609 B +689%
Throws_TUnit 6,200.18 ns -12% 81.423 ns 76.163 ns 0.1068 - 1824 B -23%
ThrowsAsync_aweXpect 12,289.42 ns 181.391 ns 169.674 ns 0.1831 - 3064 B
ThrowsAsync_FluentAssertions 27,377.61 ns +123% 916.673 ns 857.456 ns 1.4038 - 23553 B +669%
ThrowsAsync_TUnit 12,059.86 ns -2% 264.913 ns 247.799 ns 0.1678 - 2920 B -5%

@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