Remove old PerformanceTests (dotnet/corefx#31958)
authorViktor Hofer <viktor.hofer@microsoft.com>
Sun, 26 Aug 2018 15:29:38 +0000 (17:29 +0200)
committerDan Moseley <danmose@microsoft.com>
Sun, 26 Aug 2018 15:29:38 +0000 (08:29 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/6cda7c115bf5341d2dea63b03aa881acac2b7532

src/libraries/System.Runtime.Numerics/tests/Performance/Perf.BigInteger.cs
src/libraries/System.Runtime.Numerics/tests/Performance/PerformanceTests.cs [deleted file]
src/libraries/System.Runtime.Numerics/tests/Performance/System.Runtime.Numerics.Performance.Tests.csproj

index b0fce5e..5be0954 100644 (file)
@@ -18,8 +18,6 @@ namespace System.Numerics.Tests
             yield return new object[] { string.Concat(Enumerable.Repeat("1234567890", 20)) };
         }
 
-        // TODO #18249: Port disabled perf tests from tests\BigInteger\PerformanceTests.cs
-
         [Benchmark]
         [MemberData(nameof(NumberStrings))]
         public void Ctor_ByteArray(string numberString)
diff --git a/src/libraries/System.Runtime.Numerics/tests/Performance/PerformanceTests.cs b/src/libraries/System.Runtime.Numerics/tests/Performance/PerformanceTests.cs
deleted file mode 100644 (file)
index 0452d37..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using Xunit;
-using Microsoft.Xunit.Performance;
-using Xunit.Abstractions;
-
-namespace System.Numerics.Tests
-{
-    public class PerformanceTests
-    {
-        private readonly Random _random;
-        private readonly ITestOutputHelper _output;
-
-        public PerformanceTests(ITestOutputHelper output)
-        {
-            _random = new Random(1138);
-            _output = output;
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 64)]
-        [InlineData(1000000, 256, 256)]
-        [InlineData(1000000, 1024, 1024)]
-        [InlineData(100000, 4096, 4096)]
-        [InlineData(100000, 16384, 16384)]
-        [InlineData(100000, 65536, 65536)]
-        [ActiveIssue(18248)]
-        public void Add(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Add(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 64)]
-        [InlineData(1000000, 256, 256)]
-        [InlineData(1000000, 1024, 1024)]
-        [InlineData(100000, 4096, 4096)]
-        [InlineData(100000, 16384, 16384)]
-        [InlineData(100000, 65536, 65536)]
-        [ActiveIssue(18248)]
-        public void Subtract(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Subtract(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 64)]
-        [InlineData(1000000, 256, 256)]
-        [InlineData(100000, 1024, 1024)]
-        [InlineData(10000, 4096, 4096)]
-        [InlineData(1000, 16384, 16384)]
-        [InlineData(100, 65536, 65536)]
-        [ActiveIssue(18248)]
-        public void Multiply(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Multiply(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16)]
-        [InlineData(1000000, 64)]
-        [InlineData(1000000, 256)]
-        [InlineData(100000, 1024)]
-        [InlineData(10000, 4096)]
-        [InlineData(1000, 16384)]
-        [InlineData(100, 65536)]
-        [ActiveIssue(18248)]
-        public void Square(int count, int bits)
-        {
-            RunBenchmark(count, bits, v => BigInteger.Multiply(v, v));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 16)]
-        [InlineData(1000000, 256, 128)]
-        [InlineData(100000, 1024, 512)]
-        [InlineData(10000, 4096, 2048)]
-        [InlineData(1000, 16384, 8192)]
-        [InlineData(100, 65536, 32768)]
-        [ActiveIssue(18248)]
-        public void Divide(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Divide(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 16)]
-        [InlineData(1000000, 256, 128)]
-        [InlineData(100000, 1024, 512)]
-        [InlineData(10000, 4096, 2048)]
-        [InlineData(1000, 16384, 8192)]
-        [InlineData(100, 65536, 32768)]
-        [ActiveIssue(18248)]
-        public void Remainder(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.Remainder(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(1000000, 16, 16)]
-        [InlineData(1000000, 64, 64)]
-        [InlineData(100000, 256, 256)]
-        [InlineData(100000, 1024, 1024)]
-        [InlineData(10000, 4096, 4096)]
-        [InlineData(1000, 16384, 16384)]
-        [InlineData(100, 65536, 65536)]
-        [ActiveIssue(18248)]
-        public void GreatestCommonDivisor(int count, int leftBits, int rightBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, (l, r) => BigInteger.GreatestCommonDivisor(l, r));
-        }
-
-        [Benchmark] //PerformanceTest
-        [InlineData(100000, 16, 16, 16)]
-        [InlineData(10000, 64, 64, 64)]
-        [InlineData(1000, 256, 256, 256)]
-        [InlineData(100, 1024, 1024, 1024)]
-        [InlineData(10, 4096, 4096, 4096)]
-        [InlineData(1, 16384, 16384, 16384)]
-        [ActiveIssue(18248)]
-        public void ModPow(int count, int leftBits, int rightBits, int otherBits)
-        {
-            RunBenchmark(count, leftBits, rightBits, otherBits, (l, r, o) => BigInteger.ModPow(l, r, o));
-        }
-
-        private void RunBenchmark(int count, int bits, Action<BigInteger> operation)
-        {
-            BigInteger[] value = CreateIntegerSeed(count, bits);
-
-            long result = RunBenchmark(count, i => operation(value[i]));
-
-            _output.WriteLine("({1:N0}) : {2:N0} ms / {0:N0} ops", count, bits, result);
-        }
-
-        private void RunBenchmark(int count, int leftBits, int rightBits, Action<BigInteger, BigInteger> operation)
-        {
-            BigInteger[] left = CreateIntegerSeed(count, leftBits);
-            BigInteger[] right = CreateIntegerSeed(count, rightBits);
-
-            long result = RunBenchmark(count, i => operation(left[i], right[i]));
-
-            _output.WriteLine("({1:N0}; {2:N0}) : {3:N0} ms / {0:N0} ops", count, leftBits, rightBits, result);
-        }
-
-        private void RunBenchmark(int count, int leftBits, int rightBits, int otherBits, Action<BigInteger, BigInteger, BigInteger> operation)
-        {
-            BigInteger[] left = CreateIntegerSeed(count, leftBits);
-            BigInteger[] right = CreateIntegerSeed(count, rightBits);
-            BigInteger[] other = CreateIntegerSeed(count, otherBits);
-
-            long result = RunBenchmark(count, i => operation(left[i], right[i], other[i]));
-
-            _output.WriteLine("({1:N0}; {2:N0}; {3:N0}) : {4:N0} ms / {0:N0} ops", count, leftBits, rightBits, otherBits, result);
-        }
-
-        private const int MAX_SEED = 10;
-        private const int RUN_COUNT = 3;
-
-        private long RunBenchmark(int count, Action<int> operation)
-        {
-            Stopwatch watch = new Stopwatch();
-            long result = long.MaxValue;
-
-            operation(0);
-
-            for (int j = 0; j < RUN_COUNT; j++)
-            {
-                watch.Restart();
-                for (int i = 0; i < count; i++)
-                    operation(i % MAX_SEED);
-                watch.Stop();
-
-                result = Math.Min(result, watch.ElapsedMilliseconds);
-            }
-
-            return result;
-        }
-
-        private BigInteger[] CreateIntegerSeed(int count, int bits)
-        {
-            BigInteger[] seed = new BigInteger[Math.Min(count, MAX_SEED)];
-
-            for (int i = 0; i < seed.Length; i++)
-                seed[i] = CreateRandomInteger(bits);
-
-            return seed;
-        }
-
-        private BigInteger CreateRandomInteger(int bits)
-        {
-            byte[] value = new byte[(bits + 8) / 8];
-            BigInteger result = BigInteger.Zero;
-
-            while (result.IsZero)
-            {
-                _random.NextBytes(value);
-
-                // ensure actual bit count (remaining bits not set)
-                // ensure positive value (highest-order bit not set)
-                value[value.Length - 1] &= (byte)(0xFF >> 8 - bits % 8);
-
-                result = new BigInteger(value);
-            }
-
-            return result;
-        }
-    }
-}
index fd64c88..706e21a 100644 (file)
@@ -1,11 +1,10 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <ProjectGuid>{3842BE38-1A99-41B2-81B5-186E64077B95}</ProjectGuid>
     <DisableTests Condition="'$(TargetGroup)' == 'uap' AND ('$(ArchGroup)' == 'arm' OR '$(ArchGroup)' == 'arm64')">true</DisableTests>
     <Configurations>netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release</Configurations>
   </PropertyGroup>
   <ItemGroup Condition="'$(DisableTests)' != 'true'">
-    <Compile Include="PerformanceTests.cs" />
     <Compile Include="Perf.BigInteger.cs" />
     <Compile Include="Perf.BigInteger.netcoreapp.cs" Condition="'$(TargetGroup)' == 'netcoreapp'" />
     <Compile Include="$(CommonTestPath)\System\PerfUtils.cs">