Skip to content

Commit a75ea8b

Browse files
Remove xunit-performance dependency in tests (dotnet#60711)
* Remove dependence on obsolete xunit-performance We use BenchmarkDotNet in the dotnet/performance repo for benchmarking now. These copies of the benchmarks are for correctness testing, and for ease of debugging. * Make benchmarks look more like the dotnet/performance versions
1 parent 3cc122b commit a75ea8b

File tree

141 files changed

+169
-3302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+169
-3302
lines changed

eng/Versions.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@
143143
<CommandLineParserVersion>2.2.0</CommandLineParserVersion>
144144
<NETStandardLibraryRefVersion>2.1.0</NETStandardLibraryRefVersion>
145145
<NetStandardLibraryVersion>2.0.3</NetStandardLibraryVersion>
146-
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0015</XunitPerformanceApiPackageVersion>
147146
<MicrosoftDiagnosticsToolsRuntimeClientVersion>1.0.4-preview6.19326.1</MicrosoftDiagnosticsToolsRuntimeClientVersion>
148147
<MicrosoftDiagnosticsNETCoreClientVersion>0.2.61701</MicrosoftDiagnosticsNETCoreClientVersion>
149148
<DNNEVersion>1.0.26</DNNEVersion>

src/tests/Common/external/external.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454
<PackageToInclude Include="xunit.extensibility.core"/>
5555
<PackageToInclude Include="xunit.extensibility.execution"/>
5656
<PackageToInclude Include="xunit.runner.utility"/>
57-
<PackageToInclude Include="xunit.performance.api"/>
58-
<PackageToInclude Include="xunit.performance.core"/>
59-
<PackageToInclude Include="xunit.performance.execution"/>
60-
<PackageToInclude Include="xunit.performance.metrics"/>
6157
<PackageToInclude Include="Microsoft.Diagnostics.Tracing.TraceEvent"/>
6258
<PackageToInclude Include="Newtonsoft.Json"/>
6359
<PackageToInclude Include="Newtonsoft.Json.Bson"/>
@@ -70,10 +66,6 @@
7066

7167
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="1.1.1" />
7268
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
73-
<PackageReference Include="xunit.performance.api" Version="$(XunitPerformanceApiPackageVersion)" />
74-
<PackageReference Include="xunit.performance.core" Version="$(XunitPerformanceApiPackageVersion)" />
75-
<PackageReference Include="xunit.performance.execution" Version="$(XunitPerformanceApiPackageVersion)" />
76-
<PackageReference Include="xunit.performance.metrics" Version="$(XunitPerformanceApiPackageVersion)" />
7769
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="$(TraceEventVersion)" />
7870
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
7971
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees-2.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ contributed by Marek Safar
1414
*/
1515

1616
using System;
17-
using Microsoft.Xunit.Performance;
18-
19-
[assembly: OptimizeForBenchmarks]
20-
[assembly: MeasureGCCounts]
2117

2218
namespace BenchmarksGame
2319
{
@@ -37,12 +33,6 @@ public static int Main(String[] args)
3733
return check - expected + 100;
3834
}
3935

40-
[Benchmark(InnerIterationCount = 7)]
41-
public static void RunBench()
42-
{
43-
Benchmark.Iterate(() => Bench(16, false));
44-
}
45-
4636
static int Bench(int n, bool verbose)
4737
{
4838
int maxDepth = Math.Max(minDepth + 2, n);

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees-5.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ minor improvements by Alex Yakunin
1818
using System;
1919
using System.Runtime.CompilerServices;
2020
using System.Threading.Tasks;
21-
using Microsoft.Xunit.Performance;
22-
23-
[assembly: OptimizeForBenchmarks]
24-
[assembly: MeasureGCCounts]
2521

2622
namespace BenchmarksGame
2723
{
28-
public sealed class BinaryTrees_5
24+
public class BinaryTrees_5
2925
{
3026
public const int MinDepth = 4;
3127

@@ -40,12 +36,6 @@ public static int Main(string[] args)
4036
return check - expected + 100;
4137
}
4238

43-
[Benchmark(InnerIterationCount = 7)]
44-
public static void RunBench()
45-
{
46-
Benchmark.Iterate(() => Bench(16, false));
47-
}
48-
4939
static int Bench(int n, bool verbose)
5040
{
5141
var maxDepth = n < (MinDepth + 2) ? MinDepth + 2 : n;

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/fannkuch-redux/fannkuch-redux-2.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@
1313
*/
1414

1515
using System;
16-
using Microsoft.Xunit.Performance;
17-
using Xunit;
18-
19-
[assembly: OptimizeForBenchmarks]
2016

2117
namespace BenchmarksGame
2218
{
2319
public class FannkuchRedux_2
2420
{
25-
public static int[] fannkuch(int n)
21+
public int[] fannkuch(int n)
2622
{
2723
int[] p = new int[n], q = new int[n], s = new int[n];
2824
int sign = 1, maxflips = 0, sum = 0, m = n - 1;
@@ -78,24 +74,14 @@ public static int[] fannkuch(int n)
7874
static int Main(string[] args)
7975
{
8076
int n = (args.Length > 0) ? Int32.Parse(args[0]) : 7;
81-
var pf = fannkuch(n);
77+
var fr2 = new FannkuchRedux_2();
78+
var pf = fr2.fannkuch(n);
8279
Console.Write("{0}\nPfannkuchen({1}) = {2}\n", pf[0], n, pf[1]);
8380

8481
int expected = 228;
8582

8683
// Return 100 on success, anything else on failure.
8784
return pf[0] - expected + 100;
8885
}
89-
90-
[Benchmark(InnerIterationCount = 7)]
91-
[InlineData(10, 73196)]
92-
public static void RunBench(int n, int expectedSum)
93-
{
94-
Benchmark.Iterate(() =>
95-
{
96-
var pf = fannkuch(n);
97-
Assert.Equal(expectedSum, pf[0]);
98-
});
99-
}
10086
}
10187
}

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/fannkuch-redux/fannkuch-redux-5.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ parallel and small optimisations by Anthony Lloyd
1717
using System;
1818
using System.Threading;
1919
using System.Runtime.CompilerServices;
20-
using Microsoft.Xunit.Performance;
21-
using Xunit;
22-
23-
[assembly: OptimizeForBenchmarks]
2420

2521
namespace BenchmarksGame
2622
{
27-
public static class FannkuchRedux_5
23+
public class FannkuchRedux_5
2824
{
2925
static int[] fact, chkSums, maxFlips;
3026
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -113,17 +109,6 @@ public static int Main(string[] args)
113109
return sum - expected + 100;
114110
}
115111

116-
[Benchmark(InnerIterationCount = 20)]
117-
[InlineData(10, 38)]
118-
public static void RunBench(int n, int expectedSum)
119-
{
120-
Benchmark.Iterate(() =>
121-
{
122-
int sum = Bench(n, false);
123-
Assert.Equal(expectedSum, sum);
124-
});
125-
}
126-
127112
static int Bench(int n, bool verbose)
128113
{
129114
fact = new int[n + 1];

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta-1.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ modified by Josh Goldfoot (fasta-repeat buffering)
2323
using System.Text;
2424
using System.Threading;
2525
using System.Threading.Tasks;
26-
using Microsoft.Xunit.Performance;
27-
28-
[assembly: OptimizeForBenchmarks]
2926

3027
namespace BenchmarksGame
3128
{
@@ -46,12 +43,6 @@ public static int Main(string[] args)
4643
return 100;
4744
}
4845

49-
[Benchmark(InnerIterationCount = 4000)]
50-
public static void RunBench()
51-
{
52-
Benchmark.Iterate(() => Bench(5000, false));
53-
}
54-
5546
static void Bench(int n, bool verbose)
5647
{
5748
MakeCumulative(IUB);
@@ -65,8 +56,6 @@ static void Bench(int n, bool verbose)
6556
}
6657
}
6758

68-
69-
7059
public static IEnumerable<R> TransformQueue<T, R>(BlockingCollection<T> queue,
7160
Func<T, R> transform, int threadCount)
7261
{

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta-2.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ optimizations by Alp Toker <alp@atoker.com>
1616
using System;
1717
using System.IO;
1818
using System.Text;
19-
using Microsoft.Xunit.Performance;
20-
21-
[assembly: OptimizeForBenchmarks]
2219

2320
namespace BenchmarksGame
2421
{
@@ -32,12 +29,6 @@ static int Main(string[] args)
3229
return 100;
3330
}
3431

35-
[Benchmark(InnerIterationCount = 2500)]
36-
public static void RunBench()
37-
{
38-
Benchmark.Iterate(() => Bench(5000, false));
39-
}
40-
4132
static void Bench(int n, bool verbose)
4233
{
4334
MakeCumulative(HomoSapiens);

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-1.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@
1616
using System.IO;
1717
using System.Collections.Generic;
1818
using System.Text;
19-
using Microsoft.Xunit.Performance;
20-
using Xunit;
21-
22-
[assembly: OptimizeForBenchmarks]
23-
[assembly: MeasureGCCounts]
2419

2520
namespace BenchmarksGame
2621
{
27-
2822
public struct ByteString : IEquatable<ByteString>
2923
{
3024
public byte[] Array;
@@ -102,22 +96,6 @@ public static int Main(string[] args)
10296
return 100;
10397
}
10498

105-
[Benchmark(InnerIterationCount = 3)]
106-
public static void RunBench()
107-
{
108-
var helpers = new TestHarnessHelpers(bigInput: true);
109-
bool ok = true;
110-
111-
Benchmark.Iterate(() =>
112-
{
113-
using (var inputStream = helpers.GetInputStream())
114-
{
115-
ok &= Bench(inputStream, helpers, false);
116-
}
117-
});
118-
Assert.True(ok);
119-
}
120-
12199
static bool Bench(Stream inputStream, TestHarnessHelpers helpers, bool verbose)
122100
{
123101
string line;

src/tests/JIT/Performance/CodeQuality/BenchmarksGame/k-nucleotide/k-nucleotide-9.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@ submitted by Josh Goldfoot
2020
using System.Collections.Generic;
2121
using System.Threading.Tasks;
2222
using System.Runtime.CompilerServices;
23-
using Microsoft.Xunit.Performance;
24-
using Xunit;
25-
26-
[assembly: OptimizeForBenchmarks]
27-
[assembly: MeasureGCCounts]
2823

2924
namespace BenchmarksGame
3025
{
3126
class Wrapper { public int v = 1; }
32-
public static class KNucleotide_9
27+
public class KNucleotide_9
3328
{
3429
const int BLOCK_SIZE = 1024 * 1024 * 8;
3530
static List<byte[]> threeBlocks = new List<byte[]>();
@@ -265,19 +260,6 @@ public static int Main(string[] args)
265260
return (ok ? 100 : -1);
266261
}
267262

268-
[Benchmark(InnerIterationCount = 10)]
269-
public static void RunBench()
270-
{
271-
var helpers = new TestHarnessHelpers(bigInput: true);
272-
bool ok = true;
273-
274-
Benchmark.Iterate(() =>
275-
{
276-
ok &= Bench(helpers, false);
277-
});
278-
Assert.True(ok);
279-
}
280-
281263
static bool Bench(TestHarnessHelpers helpers, bool verbose)
282264
{
283265
// Reset static state

0 commit comments

Comments
 (0)