From 984b19c07ac7634ef5c3413ef07df75c2ffea504 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sat, 10 Jan 2026 22:31:10 +0000 Subject: [PATCH 1/2] chore: add .worktrees/ to gitignore Co-Authored-By: Claude Opus 4.5 --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c7af869a73..dd1360bb1a 100644 --- a/.gitignore +++ b/.gitignore @@ -435,4 +435,7 @@ doc/plans/ *speedscope*.json # Dotnet trace files -*.nettrace \ No newline at end of file +*.nettrace + +# Git worktrees +.worktrees/ \ No newline at end of file From 974dacd41eff3433c2fc09be0944e320145f0d01 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Sat, 10 Jan 2026 22:38:22 +0000 Subject: [PATCH 2/2] perf: cache CreateExecutableTestFactory delegate Cache the factory delegate instead of creating new lambdas on every property access. This avoids repeated allocations in the hot path during test execution. Fixes #4281 Co-Authored-By: Claude Opus 4.5 --- TUnit.Core/TestMetadata`1.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/TUnit.Core/TestMetadata`1.cs b/TUnit.Core/TestMetadata`1.cs index c29cc86c20..b759c25bf8 100644 --- a/TUnit.Core/TestMetadata`1.cs +++ b/TUnit.Core/TestMetadata`1.cs @@ -14,6 +14,7 @@ public class TestMetadata< { private Func? _instanceFactory; private Func? _testInvoker; + private Func? _cachedExecutableTestFactory; /// /// Strongly typed instance factory @@ -63,10 +64,16 @@ public override Func + _cachedExecutableTestFactory = (context, metadata) => { var typedMetadata = (TestMetadata)metadata; @@ -109,6 +116,8 @@ public override Func