Skip to content

Commit 54d2142

Browse files
authored
Merge pull request #340 from thomhurst/feature/speed-comparison-3
Benchmarks
2 parents 264dd42 + 13e9741 commit 54d2142

25 files changed

Lines changed: 108 additions & 308 deletions

File tree

.github/workflows/speed-comparison.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ jobs:
4747
run: dotnet build -c Release
4848
working-directory: "tools/speed-comparison/MSTestTimer"
4949

50-
- name: Run Pipeline
50+
- name: Run Benchmark
5151
run: dotnet run -c Release
52-
working-directory: "tools/speed-comparison/TUnit.SpeedComparison.Pipeline/TUnit.SpeedComparison.Pipeline"
52+
working-directory: "tools/speed-comparison/Tests.Benchmark"

Directory.Packages.props

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="AsyncSemaphore" Version="1.2.2" />
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
78
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
89
<PackageVersion Include="EnumerableAsyncProcessor" Version="1.3.2" />
910
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
@@ -25,14 +26,14 @@
2526
<PackageVersion Include="ModularPipelines.DotNet" Version="2.40.4" />
2627
<PackageVersion Include="ModularPipelines.Git" Version="2.40.4" />
2728
<PackageVersion Include="ModularPipelines.GitHub" Version="2.40.4" />
28-
<PackageVersion Include="MSTest.TestAdapter" Version="3.5.1" />
29-
<PackageVersion Include="MSTest.TestFramework" Version="3.5.1" />
30-
<PackageVersion Include="NUnit" Version="4.1.0" />
29+
<PackageVersion Include="MSTest.TestAdapter" Version="3.5.2" />
30+
<PackageVersion Include="MSTest.TestFramework" Version="3.5.2" />
31+
<PackageVersion Include="NUnit" Version="4.2.2" />
3132
<PackageVersion Include="NUnit.Analyzers" Version="4.3.0" />
3233
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
3334
<PackageVersion Include="PolySharp" Version="1.14.1" />
3435
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
35-
<PackageVersion Include="TUnit" Version="0.1.476" />
36+
<PackageVersion Include="TUnit" Version="0.1.512" />
3637
<PackageVersion Include="xunit" Version="2.9.0" />
3738
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
3839
</ItemGroup>

tools/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<Project>
2+
</Project>
Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,8 @@
1-
using System.Diagnostics;
2-
31
namespace MSTestTimer;
42

53
[TestClass]
64
public class Tests
75
{
8-
private static readonly Stopwatch Stopwatch = new();
9-
10-
[ClassInitialize]
11-
public static void Setup(TestContext _)
12-
{
13-
Stopwatch.Start();
14-
}
15-
16-
[ClassCleanup]
17-
public static void Cleanup()
18-
{
19-
Console.WriteLine(Stopwatch.Elapsed);
20-
}
21-
226
[TestMethod]
237
[DynamicData(nameof(Repeat), DynamicDataSourceType.Method)]
248
public async Task TestMethod1(int _)
@@ -28,9 +12,6 @@ public async Task TestMethod1(int _)
2812

2913
public static IEnumerable<object[]> Repeat()
3014
{
31-
foreach (var i in Enumerable.Range(0, 1001))
32-
{
33-
yield return [i];
34-
}
15+
return Enumerable.Range(0, 100).Select(i => (object[])[i]);
3516
}
3617
}

tools/speed-comparison/NUnitTimer/NUnitTimer/Tests.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
1-
using System.Diagnostics;
2-
31
namespace NUnitTimer;
42

53
[Parallelizable(ParallelScope.All)]
64
public class Tests
75
{
8-
private readonly Stopwatch _stopwatch = new();
9-
10-
[OneTimeSetUp]
11-
public void Setup()
12-
{
13-
_stopwatch.Start();
14-
}
15-
16-
[OneTimeTearDown]
17-
public void Teardown()
18-
{
19-
Console.WriteLine(_stopwatch.Elapsed);
20-
}
21-
22-
[Test, Repeat(1_000)]
6+
[Test, Repeat(100)]
237
public async Task Test1()
248
{
259
await Task.Delay(50);

tools/speed-comparison/TUnit.SpeedComparison.Pipeline/.idea/.idea.TUnit.SpeedComparison.Pipeline/.idea/.gitignore

Lines changed: 0 additions & 13 deletions
This file was deleted.

tools/speed-comparison/TUnit.SpeedComparison.Pipeline/.idea/.idea.TUnit.SpeedComparison.Pipeline/.idea/encodings.xml

Lines changed: 0 additions & 4 deletions
This file was deleted.

tools/speed-comparison/TUnit.SpeedComparison.Pipeline/.idea/.idea.TUnit.SpeedComparison.Pipeline/.idea/material_theme_project_new.xml

Lines changed: 0 additions & 13 deletions
This file was deleted.

tools/speed-comparison/TUnit.SpeedComparison.Pipeline/TUnit.SpeedComparison.Pipeline.sln

Lines changed: 0 additions & 16 deletions
This file was deleted.

tools/speed-comparison/TUnit.SpeedComparison.Pipeline/TUnit.SpeedComparison.Pipeline/FindProjectsModule.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)