TUnit.Engine/Scheduling/WaitingTestIndex.cs:85:
public HashSet<WaitingTest> GetCandidatesForReleasedKeys(IReadOnlyList<string> releasedKeys)
{
var candidates = new HashSet<WaitingTest>();
// ... fills via UnionWith ...
return candidates;
}
A fresh HashSet<WaitingTest> is allocated on every constraint-key release. Caller iterates the set then discards it.
Options:
- Pool via the existing
TUnit.Engine/Services/TestExecution/HashSetPool.cs pattern (returns pooled HashSet<T> rented from ConcurrentBag<object>).
- Or inline the union into the caller's enumeration so no intermediate set is needed (deduplication via a single
HashSet reused across calls, cleared with .Clear() before each use).
Why hot: Runs every time a constraint key is released, scaling with constrained-test count in ConstraintKeyScheduler.cs.
TFM: No gating.
TUnit.Engine/Scheduling/WaitingTestIndex.cs:85:A fresh
HashSet<WaitingTest>is allocated on every constraint-key release. Caller iterates the set then discards it.Options:
TUnit.Engine/Services/TestExecution/HashSetPool.cspattern (returns pooledHashSet<T>rented fromConcurrentBag<object>).HashSetreused across calls, cleared with.Clear()before each use).Why hot: Runs every time a constraint key is released, scaling with constrained-test count in
ConstraintKeyScheduler.cs.TFM: No gating.