Skip to content

Testing And Performance Analysis

ZjzMisaka edited this page Nov 15, 2025 · 33 revisions

Unit Testing

PowerThreadPool has been meticulously tested, achieving

  • 100% test coverage
    Codecov
    Codecov
  • Extensive use of Assert

to ensure robustness and reliability in various scenarios.

Benchmark

BenchmarkSyncWork

Run 1,000 tasks, each task performs 100,000 square root calculations


BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.6899)
Unknown processor
.NET SDK 9.0.304
  [Host]     : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Method Mean Error StdDev Gen0 Gen1 Allocated
TestDotnetThreadPool 2.819 ms 0.0478 ms 0.0424 ms - - 31.46 KB
TestSmartThreadPool 2.902 ms 0.0251 ms 0.0235 ms 42.9688 39.0625 554.73 KB
TestPowerThreadPool 2.864 ms 0.0479 ms 0.0448 ms 31.2500 7.8125 428.48 KB

BenchmarkSyncShortWork

Run 1,000,000 tasks, each task performs 10 square root calculations


BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.6899)
Unknown processor
.NET SDK 9.0.304
  [Host]     : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
TestDotnetThreadPool 141.4 ms 3.38 ms 9.96 ms 3250.0000 3000.0000 750.0000 30.52 MB
TestSmartThreadPool 1,915.8 ms 37.91 ms 42.14 ms 44000.0000 - - 535.78 MB
TestPowerThreadPool 375.0 ms 6.84 ms 6.40 ms 35000.0000 - - 422.86 MB

BenchmarkAsyncWork

Run 50 tasks, each task contains 3 await Task.Delay(10);


BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.6899)
Unknown processor
.NET SDK 9.0.304
  [Host]     : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Method Mean Error StdDev Allocated
TestTask 46.58 ms 0.246 ms 0.230 ms 37.43 KB
TestPowerThreadPool 46.43 ms 0.226 ms 0.200 ms 264.62 KB
TestPowerThreadPoolSync 326.31 ms 0.873 ms 0.817 ms 57.37 KB

BenchmarkAsyncShortWork

Run 10,000 tasks, each task contains 10 await Task.Delay(0);


BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.6899)
Unknown processor
.NET SDK 9.0.304
  [Host]     : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2
  DefaultJob : .NET 8.0.19 (8.0.1925.36514), X64 RyuJIT AVX2

Method Mean Error StdDev Gen0 Gen1 Allocated
TestTask 2.111 ms 0.0301 ms 0.0267 ms 121.0938 87.8906 1.45 MB
TestPowerThreadPool 7.907 ms 0.0448 ms 0.0419 ms 2562.5000 93.7500 30.59 MB
TestPowerThreadPoolSync 4.295 ms 0.0272 ms 0.0254 ms 375.0000 - 4.47 MB

Clone this wiki locally