Skip to content

Commit 488cfa8

Browse files
committed
refactor: update parallelism handling in TestScheduler for improved performance
1 parent 1e29edc commit 488cfa8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

TUnit.Engine/Scheduling/TestScheduler.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,7 @@ private async Task ExecuteUnlimitedAsync(
473473
List<AbstractExecutableTest> tests,
474474
CancellationToken cancellationToken)
475475
{
476-
// Execute tests without limiters - still apply global parallelism limit to prevent thread pool saturation
477-
// "Unlimited" means no per-test constraints (ParallelLimiter), not unlimited concurrency
476+
// Execute tests without per-test limiters, but still apply global parallelism limit
478477
await Parallel.ForEachAsync(
479478
tests,
480479
new ParallelOptions
@@ -551,11 +550,10 @@ private static int GetMaxParallelism(ILogger logger, ICommandLineOptions command
551550
}
552551
}
553552

554-
// Default: 4x CPU cores (balanced for mixed CPU/I/O workloads)
555-
// Higher values can cause thread pool saturation with many async tests
553+
// Default: 8x CPU cores (empirically optimized for async/IO-bound workloads)
556554
// Users can override via --maximum-parallel-tests or TUNIT_MAX_PARALLEL_TESTS
557-
var defaultLimit = Environment.ProcessorCount * 4;
558-
logger.LogDebug($"Maximum parallel tests limit defaulting to {defaultLimit} ({Environment.ProcessorCount} processors * 4)");
555+
var defaultLimit = Environment.ProcessorCount * 8;
556+
logger.LogDebug($"Maximum parallel tests limit defaulting to {defaultLimit} ({Environment.ProcessorCount} processors * 8)");
559557
return defaultLimit;
560558
}
561559
}

0 commit comments

Comments
 (0)