summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Performance/CodeQuality
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/Performance/CodeQuality')
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Adams/Adams.cs9
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/BenchMk2/BenchMk2.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/BenchMrk/BenchMrk.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Bisect/Bisect.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/DMath/DMath.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/FFT/FFT.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/InProd/InProd.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/InvMt/InvMt.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/LLoops/LLoops.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Lorenz/Lorenz.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/MatInv4/MatInv4.cs17
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/NewtE/NewtE.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/NewtR/NewtR.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Regula/Regula.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Romber/Romber.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Secant/Secant.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Simpsn/Simpsn.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/SqMtx/SqMtx.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Trap/Trap.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchF/Whetsto/Whetsto.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/8Queens/8Queens.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Ackermann/Ackermann.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/AddArray/AddArray.cs9
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/AddArray2/AddArray2.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Array1/Array1.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Array2/Array2.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/BenchE/BenchE.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort/BubbleSort.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort2/BubbleSort2.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/CSieve/CSieve.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Fib/Fib.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/HeapSort/HeapSort.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/IniArray/IniArray.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/LogicArray/LogicArray.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Midpoint/Midpoint.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/MulMatrix/MulMatrix.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/NDhrystone/NDhrystone.cs45
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Permutate/Permutate.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Pi/Pi.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/Puzzle/Puzzle.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/QuickSort/QuickSort.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/TreeInsert/TreeInsert.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/TreeSort/TreeSort.cs9
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchI/XposMatrix/XposMatrix.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees.csharp.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta.csharp-2.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fastaredux/fastaredux.csharp.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/nbody/nbody.csharp-3.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/pidigits/pi-digits.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs9
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsByte.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsChar.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsDouble.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsFloat.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsInt.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsLong.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsSByte.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsShort.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsString.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUInt.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsULong.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUShort.cs3
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.cs148
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.csproj44
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Inlining/NoThrowInline.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/SIMD/ConsoleMandel/ConsoleMandel.cs4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/RayTracerBench.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.cs159
-rw-r--r--tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.csproj43
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Serialization/Deserialize.cs7
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Serialization/Serialize.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs2
-rw-r--r--tests/src/JIT/Performance/CodeQuality/V8/DeltaBlue/DeltaBlue.cs5
-rw-r--r--tests/src/JIT/Performance/CodeQuality/V8/Richards/Richards.cs18
74 files changed, 681 insertions, 86 deletions
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Adams/Adams.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Adams/Adams.cs
index 427ec9269e..431d857f16 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Adams/Adams.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Adams/Adams.cs
@@ -18,6 +18,8 @@ using Microsoft.Xunit.Performance;
[assembly: MeasureInstructionsRetired]
#endif // XUNIT_PERF
+namespace Benchstone.BenchF
+{
public static class Adams
{
#if DEBUG
@@ -41,7 +43,7 @@ public static class Adams
#if VERBOSE
Console.WriteLine(" ADAMS-MOULTON METHOD ");
-#endif // VERBOSE
+#endif // VERBOSE
n = 4;
h = 1.0 / 32.0;
@@ -67,7 +69,7 @@ public static class Adams
f[i] = xn + yn;
#if VERBOSE
Console.WriteLine("{0}, {1}, {2}, {3}, {4}", k, xn, yn, dn, en);
-#endif // VERBOSE
+#endif // VERBOSE
}
for (k = 4; k <= nstep; k++)
@@ -137,7 +139,7 @@ public static class Adams
bool result = true;
// Note: we can't check xn or yn better because of the precision
- // with which original results are given
+ // with which original results are given
result &= System.Math.Abs(g_xn_base - g_xn) <= 1.5e-7;
result &= System.Math.Abs(g_yn_base - g_yn) <= 1.5e-7;
result &= System.Math.Abs(g_dn) <= 2.5e-9;
@@ -161,3 +163,4 @@ public static class Adams
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMk2/BenchMk2.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMk2/BenchMk2.cs
index 970164405b..c4cfc0b217 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMk2/BenchMk2.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMk2/BenchMk2.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class BenchMk2
{
#if DEBUG
@@ -64,3 +66,4 @@ public static class BenchMk2
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMrk/BenchMrk.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMrk/BenchMrk.cs
index 27a5fe617c..f342b2d84e 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMrk/BenchMrk.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/BenchMrk/BenchMrk.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class BenchMrk
{
#if DEBUG
@@ -64,3 +66,4 @@ public static class BenchMrk
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Bisect/Bisect.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Bisect/Bisect.cs
index 1c27003567..724416a626 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Bisect/Bisect.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Bisect/Bisect.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Bisect
{
#if DEBUG
@@ -161,3 +163,4 @@ public static class Bisect
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/DMath/DMath.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/DMath/DMath.cs
index a2c3a385cd..47c5e20285 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/DMath/DMath.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/DMath/DMath.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class DMath
{
#if DEBUG
@@ -110,4 +112,5 @@ public static class DMath
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/FFT/FFT.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/FFT/FFT.cs
index 3e853273fb..8881eae6c6 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/FFT/FFT.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/FFT/FFT.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class FFT
{
#if DEBUG
@@ -151,3 +153,4 @@ public static class FFT
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/InProd/InProd.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/InProd/InProd.cs
index ff54ea7acd..26096b736e 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/InProd/InProd.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/InProd/InProd.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class InProd
{
#if DEBUG
@@ -132,3 +134,4 @@ public static class InProd
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/InvMt/InvMt.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/InvMt/InvMt.cs
index a5f387b7f5..6ecfb62d91 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/InvMt/InvMt.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/InvMt/InvMt.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class InvMt
{
#if DEBUG
@@ -135,3 +137,4 @@ public static class InvMt
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/LLoops/LLoops.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/LLoops/LLoops.cs
index 6dcb6c435c..73ec09aa04 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/LLoops/LLoops.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/LLoops/LLoops.cs
@@ -60,6 +60,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public class LLoops
{
#if DEBUG
@@ -648,3 +650,4 @@ public class LLoops
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Lorenz/Lorenz.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Lorenz/Lorenz.cs
index bff6398d3b..5819446bf0 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Lorenz/Lorenz.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Lorenz/Lorenz.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Lorenz
{
#if DEBUG
@@ -132,3 +134,4 @@ public static class Lorenz
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/MatInv4/MatInv4.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/MatInv4/MatInv4.cs
index eb5e33b130..a00c29b843 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/MatInv4/MatInv4.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/MatInv4/MatInv4.cs
@@ -10,6 +10,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class MatInv4
{
#if DEBUG
@@ -217,11 +219,11 @@ public static class MatInv4
// 0 < ik <= n^2
ik = nk + i;
hold = a[ik - 1];
- // -n < ij <= 0
+ // -n < ij <= 0
ij = i - n;
for (j = 1; j <= n; ++j)
{
- // i <= n, ij <= n + n + ... + n (n times) or ij <= n * n
+ // i <= n, ij <= n + n + ... + n (n times) or ij <= n * n
ij = ij + n;
if (j == k)
{
@@ -237,7 +239,7 @@ public static class MatInv4
kj = k - n;
for (j = 1; j <= n; ++j)
{
- // k <= n, kj <= n + n + ... + n (n times) or kj <= n * n
+ // k <= n, kj <= n + n + ... + n (n times) or kj <= n * n
kj = kj + n;
if (j == k)
{
@@ -268,11 +270,11 @@ public static class MatInv4
jr = n * (i - 1);
for (j = 1; j <= n; ++j)
{
- // jk <= n^2 - n + n
+ // jk <= n^2 - n + n
// jk <= n^2
jk = jq + j;
hold = a[jk - 1];
- // ji <= n^2 - n + n
+ // ji <= n^2 - n + n
// ji <= n^2
ji = jr + j;
a[jk - 1] = -a[ji - 1];
@@ -288,7 +290,7 @@ public static class MatInv4
ki = k - n;
for (i = 1; i <= n; ++i)
{
- // ki <= n + n + ... + n (n times) or ki <= n * n
+ // ki <= n + n + ... + n (n times) or ki <= n * n
ki = ki + n;
hold = a[ki - 1];
// if i=1, ji = (1 + (n-1) * n) - 1 + n ==> ij = n^2
@@ -378,7 +380,7 @@ public static class MatInv4
{
if (j != k)
{
- // Accessing upto n^2 - n + n - 1 ==> n^2 - 1
+ // Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(i - 1) * n + (j - 1)] = a[(i - 1) * n + (k - 1)] * a[(k - 1) * n + (j - 1)] + a[(i - 1) * n + (j - 1)];
}
}
@@ -493,3 +495,4 @@ public static class MatInv4
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/NewtE/NewtE.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/NewtE/NewtE.cs
index 0fc14132f1..47f90d8616 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/NewtE/NewtE.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/NewtE/NewtE.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class NewtE
{
#if DEBUG
@@ -133,3 +135,4 @@ public static class NewtE
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/NewtR/NewtR.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/NewtR/NewtR.cs
index cf945bc110..c590f6e570 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/NewtR/NewtR.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/NewtR/NewtR.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class NewtR
{
#if DEBUG
@@ -129,3 +131,4 @@ public static class NewtR
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Regula/Regula.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Regula/Regula.cs
index 9743ab698c..0011288e55 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Regula/Regula.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Regula/Regula.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Regula
{
#if DEBUG
@@ -191,3 +193,4 @@ public static class Regula
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Romber/Romber.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Romber/Romber.cs
index 5824cd43cc..a4d56f7b0f 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Romber/Romber.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Romber/Romber.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Romber
{
#if DEBUG
@@ -167,3 +169,4 @@ public static class Romber
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Secant/Secant.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Secant/Secant.cs
index e7d1ace2e6..060fb5b0a4 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Secant/Secant.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Secant/Secant.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Secant
{
#if DEBUG
@@ -140,3 +142,4 @@ public static class Secant
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Simpsn/Simpsn.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Simpsn/Simpsn.cs
index e1e9f0eb1f..5b2df292af 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Simpsn/Simpsn.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Simpsn/Simpsn.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Simpsn
{
#if DEBUG
@@ -91,3 +93,4 @@ public static class Simpsn
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/SqMtx/SqMtx.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/SqMtx/SqMtx.cs
index 673757cedf..b22aad88b7 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/SqMtx/SqMtx.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/SqMtx/SqMtx.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class SqMtx
{
#if DEBUG
@@ -101,3 +103,4 @@ public static class SqMtx
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Trap/Trap.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Trap/Trap.cs
index a5e3e5c0d6..3a0de102ed 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Trap/Trap.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Trap/Trap.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Trap
{
#if DEBUG
@@ -94,3 +96,4 @@ public static class Trap
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchF/Whetsto/Whetsto.cs b/tests/src/JIT/Performance/CodeQuality/BenchF/Whetsto/Whetsto.cs
index 2ab0b61ee0..ffe3fa5d8b 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchF/Whetsto/Whetsto.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchF/Whetsto/Whetsto.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchF
+{
public static class Whetsto
{
#if DEBUG
@@ -240,3 +242,4 @@ public static class Whetsto
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/8Queens/8Queens.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/8Queens/8Queens.cs
index 76ed0c8e71..e641ee0a74 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/8Queens/8Queens.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/8Queens/8Queens.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class EightQueens
{
@@ -68,7 +70,7 @@ public static class EightQueens
}
i = i + 1;
}
-
+
TryMe(1, ref q, b, a);
return (q == 1);
@@ -92,9 +94,10 @@ public static class EightQueens
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Ackermann/Ackermann.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Ackermann/Ackermann.cs
index 512f35f82d..5bfa196527 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Ackermann/Ackermann.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Ackermann/Ackermann.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Ackermann
{
@@ -40,7 +42,7 @@ public static class Ackermann
int a33 = Acker(3, 3);
return (a00 == 1) && (a11 == 3) && (a22 == 7) & (a33 == 61);
}
-
+
[Benchmark]
public static void Test() {
foreach (var iteration in Benchmark.Iterations) {
@@ -59,9 +61,10 @@ public static class Ackermann
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray/AddArray.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray/AddArray.cs
index 0fa2ff90eb..d38e6b4475 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray/AddArray.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray/AddArray.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class AddArray
{
@@ -48,14 +50,14 @@ public static class AddArray
m = j;
flags4[m] = flags3[l] + m + m + m + m;
}
-
+
for (j = 0; j <= Size; j++) {
k = j;
l = j;
m = j;
flags1[j] = flags1[j] + flags2[k] + flags3[l] + flags4[m] - flags2[k - j + l];
}
-
+
// Escape each flags array so that their elements will appear live-out
Escape(flags1);
Escape(flags2);
@@ -83,9 +85,10 @@ public static class AddArray
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray2/AddArray2.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray2/AddArray2.cs
index 865b9445f6..a6004f0309 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray2/AddArray2.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/AddArray2/AddArray2.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class AddArray2
{
#if DEBUG
@@ -129,3 +131,4 @@ public static class AddArray2
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Array1/Array1.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Array1/Array1.cs
index 8d5dbd6153..780b7ce66f 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Array1/Array1.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Array1/Array1.cs
@@ -18,6 +18,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Array1
{
#if DEBUG
@@ -152,3 +154,4 @@ public static class Array1
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Array2/Array2.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Array2/Array2.cs
index 1b720b94fa..dac100c5a7 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Array2/Array2.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Array2/Array2.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Array2
{
@@ -75,7 +77,7 @@ public static class Array2
}
bool result = VerifyCopy(s, d);
-
+
return result;
}
@@ -92,9 +94,10 @@ public static class Array2
bool result = Bench(Iterations);
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/BenchE/BenchE.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/BenchE/BenchE.cs
index 9cf7d770dc..b16c48280b 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/BenchE/BenchE.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/BenchE/BenchE.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class BenchE
{
#if DEBUG
@@ -115,3 +117,4 @@ public static class BenchE
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort/BubbleSort.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort/BubbleSort.cs
index 78626fffc9..558484d3d6 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort/BubbleSort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort/BubbleSort.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class BubbleSort
{
@@ -43,7 +45,7 @@ public static class BubbleSort
return false;
}
}
-
+
return true;
}
@@ -79,9 +81,10 @@ public static class BubbleSort
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort2/BubbleSort2.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort2/BubbleSort2.cs
index 55e5a5f8c5..8c2e63a954 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort2/BubbleSort2.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/BubbleSort2/BubbleSort2.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class BubbleSort2
{
@@ -82,9 +84,10 @@ public static class BubbleSort2
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/CSieve/CSieve.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/CSieve/CSieve.cs
index 606f740fb6..aca263711d 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/CSieve/CSieve.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/CSieve/CSieve.cs
@@ -12,6 +12,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class CSieve
{
@@ -74,9 +76,10 @@ public static class CSieve
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Fib/Fib.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Fib/Fib.cs
index 01064bb168..ee028db20f 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Fib/Fib.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Fib/Fib.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Fib
{
@@ -30,7 +32,7 @@ public static class Fib
return 1;
}
}
-
+
[MethodImpl(MethodImplOptions.NoInlining)]
static bool Bench() {
int fib = Fibonacci(Number);
@@ -55,9 +57,10 @@ public static class Fib
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/HeapSort/HeapSort.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/HeapSort/HeapSort.cs
index 9fd7aa32e0..64b5c8f33b 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/HeapSort/HeapSort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/HeapSort/HeapSort.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class HeapSort
{
@@ -32,7 +34,7 @@ public static class HeapSort
j = i;
k = j / 2;
m = x[i];
-
+
// 0 < k <= (n / 2)
// 1 <= j <= n
while (k > 0) {
@@ -113,9 +115,10 @@ public static class HeapSort
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/IniArray/IniArray.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/IniArray/IniArray.cs
index 78fa233dbf..268af7b779 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/IniArray/IniArray.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/IniArray/IniArray.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class IniArray
{
@@ -52,9 +54,10 @@ public static class IniArray
bool result = Bench();
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/LogicArray/LogicArray.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/LogicArray/LogicArray.cs
index f5ff746b86..c5b4e3b0d8 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/LogicArray/LogicArray.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/LogicArray/LogicArray.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class LogicArray
{
@@ -89,9 +91,10 @@ public static class LogicArray
bool result = Bench();
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Midpoint/Midpoint.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Midpoint/Midpoint.cs
index 6e4f193746..9146874358 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Midpoint/Midpoint.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Midpoint/Midpoint.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Midpoint
{
@@ -96,9 +98,10 @@ public static class Midpoint
bool result = Bench();
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/MulMatrix/MulMatrix.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/MulMatrix/MulMatrix.cs
index 3f9c224d3d..a45c012984 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/MulMatrix/MulMatrix.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/MulMatrix/MulMatrix.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class MulMatrix
{
@@ -19,7 +21,7 @@ public static class MulMatrix
#else
public const int Iterations = 100;
#endif
-
+
const int Size = 75;
static volatile object VolatileObject;
@@ -132,9 +134,10 @@ public static class MulMatrix
bool result = Bench();
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/NDhrystone/NDhrystone.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/NDhrystone/NDhrystone.cs
index c2526748ce..33effcbf40 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/NDhrystone/NDhrystone.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/NDhrystone/NDhrystone.cs
@@ -7,7 +7,7 @@
// Dhrystone: a synthetic systems programming benchmark
// Reinhold P. Weicker
// Communications of the ACM, Volume 27 Issue 10, Oct 1984, Pages 1013-1030
-
+
using Microsoft.Xunit.Performance;
using System;
using System.Runtime.CompilerServices;
@@ -16,6 +16,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class NDhrystone
{
@@ -63,9 +65,9 @@ public static class NDhrystone
int intLoc2;
int intLoc3 = 0;
Enumeration enumLoc;
-
+
int i; /* modification */
-
+
m_ptrGlb.PtrComp = m_ptrGlbNext;
m_ptrGlb.Discr = Enumeration.Ident1;
m_ptrGlb.EnumComp = Enumeration.Ident3;
@@ -117,12 +119,12 @@ public static class NDhrystone
ptrParIn = ptrParIn.PtrComp;
}
}
-
+
static void Proc2(ref int intParIO) {
int intLoc;
Enumeration enumLoc = Enumeration.Ident2;
intLoc = intParIO + 10;
-
+
for (;;) {
if (s_char1Glob == 'A') {
--intLoc;
@@ -142,17 +144,17 @@ public static class NDhrystone
else {
s_intGlob = 100;
}
-
+
Proc7(10, s_intGlob, ref m_ptrGlb.IntComp);
}
-
+
static void Proc4() {
bool boolLoc;
boolLoc = s_char1Glob == 'A';
boolLoc |= s_boolGlob;
s_char2Glob = 'B';
}
-
+
static void Proc5() {
s_char1Glob = 'A';
s_boolGlob = false;
@@ -163,12 +165,12 @@ public static class NDhrystone
if (!Func3(enumParIn)) {
enumParOut = Enumeration.Ident4;
}
-
+
switch (enumParIn) {
- case Enumeration.Ident1:
+ case Enumeration.Ident1:
enumParOut = Enumeration.Ident1;
break;
- case Enumeration.Ident2:
+ case Enumeration.Ident2:
if (s_intGlob > 100) {
enumParOut = Enumeration.Ident1;
}
@@ -176,12 +178,12 @@ public static class NDhrystone
enumParOut = Enumeration.Ident4;
}
break;
- case Enumeration.Ident3:
+ case Enumeration.Ident3:
enumParOut = Enumeration.Ident2;
break;
- case Enumeration.Ident4:
+ case Enumeration.Ident4:
break;
- case Enumeration.Ident5:
+ case Enumeration.Ident5:
enumParOut = Enumeration.Ident3;
break;
}
@@ -192,7 +194,7 @@ public static class NDhrystone
intLoc = intParI1 + 2;
intParOut = intParI2 + intLoc;
}
-
+
static void Proc8(int[] array1Par, int[][] array2Par, int intParI1, int intParI2) {
int intLoc;
intLoc = intParI1 + 5;
@@ -206,7 +208,7 @@ public static class NDhrystone
array2Par[intLoc + 20][intLoc] = array1Par[intLoc];
s_intGlob = 5;
}
-
+
static Enumeration Func1(char charPar1, char charPar2) {
char charLoc1;
char charLoc2;
@@ -219,7 +221,7 @@ public static class NDhrystone
return (Enumeration.Ident2);
}
}
-
+
static bool Func2(char[] strParI1, char[] strParI2) {
int intLoc;
char charLoc = '\0';
@@ -243,18 +245,18 @@ public static class NDhrystone
return true;
}
}
-
+
return false;
}
}
-
+
static bool Func3(Enumeration enumParIn) {
Enumeration enumLoc;
enumLoc = enumParIn;
if (enumLoc == Enumeration.Ident3) {
return true;
}
-
+
return false;
}
@@ -278,9 +280,10 @@ public static class NDhrystone
bool result = Bench();
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Permutate/Permutate.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Permutate/Permutate.cs
index d7457cdbc1..43fc28b370 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Permutate/Permutate.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Permutate/Permutate.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public class Permutate
{
#if DEBUG
@@ -114,3 +116,4 @@ public class Permutate
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Pi/Pi.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Pi/Pi.cs
index 112ff6df9b..2fe0918784 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Pi/Pi.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Pi/Pi.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class Pi
{
@@ -78,9 +80,10 @@ public static class Pi
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/Puzzle/Puzzle.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/Puzzle/Puzzle.cs
index 2b1c2847f4..2271e02455 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/Puzzle/Puzzle.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/Puzzle/Puzzle.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public class Puzzle
{
#if DEBUG
@@ -391,3 +393,4 @@ public class Puzzle
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/QuickSort/QuickSort.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/QuickSort/QuickSort.cs
index 191211aaa8..7cdac96a69 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/QuickSort/QuickSort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/QuickSort/QuickSort.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class QuickSort
{
@@ -52,7 +54,7 @@ public static class QuickSort
arr[j] = temp;
}
}
-
+
// need to swap the pivot and a[i](or a[j] as i==j) so
// that the pivot will be at its final place in the sorted array
@@ -108,9 +110,10 @@ public static class QuickSort
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/TreeInsert/TreeInsert.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/TreeInsert/TreeInsert.cs
index 8a24240538..2867abc4d4 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/TreeInsert/TreeInsert.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/TreeInsert/TreeInsert.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public class TreeInsert
{
#if DEBUG
@@ -136,3 +138,4 @@ public class TreeInsert
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/TreeSort/TreeSort.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/TreeSort/TreeSort.cs
index 68b5c965f7..e0971346cf 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/TreeSort/TreeSort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/TreeSort/TreeSort.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class TreeSort
{
@@ -74,7 +76,7 @@ public static class TreeSort
else {
Insert(n, t.Left);
}
- }
+ }
else if (n < t.Val) {
if (t.Right == null) {
t.Right = new Node(n);
@@ -117,7 +119,7 @@ public static class TreeSort
bool result = CheckTree(tree);
return result;
}
-
+
[MethodImpl(MethodImplOptions.NoInlining)]
static bool Bench() {
int[] sortList = new int[SortElements + 1];
@@ -143,9 +145,10 @@ public static class TreeSort
}
return result;
}
-
+
public static int Main() {
bool result = TestBase();
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchI/XposMatrix/XposMatrix.cs b/tests/src/JIT/Performance/CodeQuality/BenchI/XposMatrix/XposMatrix.cs
index 0bb17b8cc5..de8b486049 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchI/XposMatrix/XposMatrix.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchI/XposMatrix/XposMatrix.cs
@@ -11,6 +11,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Benchstone.BenchI
+{
public static class XposMatrix
{
public const int ArraySize = 100;
@@ -48,11 +50,11 @@ public static class XposMatrix
matrix[i][j] = 1;
}
}
-
+
if (matrix[n][n] != 1) {
return false;
}
-
+
Inner(matrix, n);
if (matrix[n][n] != 1) {
@@ -88,3 +90,4 @@ public static class XposMatrix
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees.csharp.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees.csharp.cs
index e4118b2963..c77e802989 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees.csharp.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/binarytrees/binarytrees.csharp.cs
@@ -2,9 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/* The Computer Language Benchmarks Game
- http://benchmarksgame.alioth.debian.org/
+ http://benchmarksgame.alioth.debian.org/
- contributed by Marek Safar
+ contributed by Marek Safar
modified for use with xunit-performance
*/
@@ -17,6 +17,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public class BinaryTrees
{
private const int minDepth = 4;
@@ -149,3 +151,4 @@ public class BinaryTrees
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta.csharp-2.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta.csharp-2.cs
index c58ce0bd97..92fbceb692 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta.csharp-2.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fasta/fasta.csharp-2.cs
@@ -18,6 +18,8 @@ using System.Text;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public class Fasta
{
#if DEBUG
@@ -218,3 +220,4 @@ public class Fasta
s.Write(s_buf, 0, s_index);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fastaredux/fastaredux.csharp.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fastaredux/fastaredux.csharp.cs
index 7128e326fc..df8999a2de 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fastaredux/fastaredux.csharp.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/fastaredux/fastaredux.csharp.cs
@@ -18,6 +18,8 @@ using System.Text;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public static class FastaRedux
{
#if DEBUG
@@ -181,4 +183,5 @@ public static class FastaRedux
if (br < BUF_LEN) s.Write(s_buf, 0, BUF_LEN - br);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/nbody/nbody.csharp-3.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/nbody/nbody.csharp-3.cs
index 70c87095ad..2124cf4d9e 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/nbody/nbody.csharp-3.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/nbody/nbody.csharp-3.cs
@@ -15,6 +15,8 @@ using System;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public class NBody
{
public static int Main(String[] args)
@@ -153,4 +155,5 @@ internal class NBodySystem
return e;
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/pidigits/pi-digits.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/pidigits/pi-digits.cs
index 3395e29a55..7e36f0e424 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/pidigits/pi-digits.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/pidigits/pi-digits.cs
@@ -6,7 +6,7 @@
*
* Port of the C code that uses GMP
* Just switched it to use C#'s BigInteger instead
- *
+ *
* To compile use csc /o+ /r:System.Numerics.dll
*
* modified for use with xunit-performance
@@ -20,6 +20,8 @@ using System.Text;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public class pidigits
{
#if DEBUG
@@ -111,4 +113,5 @@ public class pidigits
}
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
index 9e984864a7..01eeea07bf 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
@@ -3,8 +3,8 @@
// See the LICENSE file in the project root for more information.
/* The Computer Language Benchmarks Game
http://benchmarksgame.alioth.debian.org/
-
- contributed by Isaac Gouy
+
+ contributed by Isaac Gouy
modified for use with xunit-performance
*/
@@ -15,6 +15,8 @@ using System;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace BenchmarksGame
+{
public class SpectralNorm
{
#if DEBUG
@@ -78,7 +80,7 @@ public class SpectralNorm
}
// B=AtA A multiplied by A transposed
- // v.Bv /(v.v) eigenvalue of v
+ // v.Bv /(v.v) eigenvalue of v
double vBv = 0, vv = 0;
for (int i = 0; i < n; i++)
{
@@ -124,3 +126,4 @@ public class SpectralNorm
MultiplyAtv(n, u, AtAv);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsByte.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsByte.cs
index 8271c40a43..3b28f87fe5 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsByte.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsByte.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsByte
{
@@ -928,3 +930,4 @@ public static class ConstantArgsByte
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsChar.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsChar.cs
index 0d1f9284ba..0cc4b9c558 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsChar.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsChar.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsChar
{
@@ -928,3 +930,4 @@ public static class ConstantArgsChar
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsDouble.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsDouble.cs
index 6c95d482d5..4bd5683f0c 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsDouble.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsDouble.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsDouble
{
@@ -808,3 +810,4 @@ public static class ConstantArgsDouble
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsFloat.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsFloat.cs
index bbd65a4004..f609a4bb44 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsFloat.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsFloat.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsFloat
{
@@ -808,3 +810,4 @@ public static class ConstantArgsFloat
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsInt.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsInt.cs
index 03d59f93d0..f54e800d17 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsInt.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsInt.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsInt
{
@@ -928,3 +930,4 @@ public static class ConstantArgsInt
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsLong.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsLong.cs
index f4e45f50db..e5679f1638 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsLong.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsLong.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsLong
{
@@ -928,3 +930,4 @@ public static class ConstantArgsLong
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsSByte.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsSByte.cs
index b329122967..0ec29b8341 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsSByte.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsSByte.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsSByte
{
@@ -928,3 +930,4 @@ public static class ConstantArgsSByte
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsShort.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsShort.cs
index 8718111a72..f8cf23e8da 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsShort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsShort.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsShort
{
@@ -928,3 +930,4 @@ public static class ConstantArgsShort
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsString.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsString.cs
index b7319086d7..38a3f7e6b9 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsString.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsString.cs
@@ -16,6 +16,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsString
{
@@ -328,3 +330,4 @@ public static class ConstantArgsString
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUInt.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUInt.cs
index db3316ea32..e3f6e2aae8 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUInt.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUInt.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsUInt
{
@@ -888,3 +890,4 @@ public static class ConstantArgsUInt
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsULong.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsULong.cs
index 72087077e2..7585a3e1fc 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsULong.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsULong.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsULong
{
@@ -888,3 +890,4 @@ public static class ConstantArgsULong
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUShort.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUShort.cs
index 249e985496..c96274e424 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUShort.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/ConstantArgsUShort.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class ConstantArgsUShort
{
@@ -928,3 +930,4 @@ public static class ConstantArgsUShort
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.cs
new file mode 100644
index 0000000000..660627cc72
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.cs
@@ -0,0 +1,148 @@
+// 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.
+
+// In CoreCLR String.Format(ref, ref) is small and readily inlined.
+// The inline introduces a System.Parms GC struct local which is
+// untracked and must be zero initialized in the prolog. When the
+// inlined callsite is in a cold path, the inline hurts performance.
+//
+// There are two test methods below, one of which calls String.Format
+// on a cold path and the other which has similar structure but
+// does not call String.Format. Expectation is that they will have
+// similar performance.
+//
+// See https://github.com/dotnet/coreclr/issues/7569 for context.
+
+using Microsoft.Xunit.Performance;
+using System;
+using System.Runtime.CompilerServices;
+using Xunit;
+
+[assembly: OptimizeForBenchmarks]
+[assembly: MeasureInstructionsRetired]
+
+namespace Inlining
+{
+public class InlineGCStruct
+{
+#if DEBUG
+ public const int Iterations = 1;
+#else
+ public const int Iterations = 2500000;
+#endif
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static int FastFunctionNotCallingStringFormat(int param)
+ {
+ if (param < 0)
+ {
+ throw new Exception(String.Format("We do not like the value {0:N0}.", param));
+ }
+
+ if (param == int.MaxValue)
+ {
+ throw new Exception(String.Format("{0:N0} is maxed out.", param));
+ }
+
+ if (param > int.MaxValue / 2)
+ {
+ throw new Exception(String.Format("We do not like the value {0:N0} either.", param));
+ }
+
+ return param * 2;
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static int FastFunctionNotHavingStringFormat(int param)
+ {
+ if (param < 0)
+ {
+ throw new ArgumentOutOfRangeException("param", "We do not like this value.");
+ }
+
+ if (param == int.MaxValue)
+ {
+ throw new ArgumentOutOfRangeException("param", "Maxed out.");
+ }
+
+ if (param > int.MaxValue / 2)
+ {
+ throw new ArgumentOutOfRangeException("param", "We do not like this value either.");
+ }
+
+ return param * 2;
+ }
+
+ [Benchmark]
+ public static bool WithFormat()
+ {
+ int result = 0;
+
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ for (int i = 0; i < Iterations; i++)
+ {
+ result |= FastFunctionNotCallingStringFormat(11);
+ }
+ }
+ }
+
+ return (result == 22);
+ }
+
+ [Benchmark]
+ public static bool WithoutFormat()
+ {
+ int result = 0;
+
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ for (int i = 0; i < Iterations; i++)
+ {
+ result |= FastFunctionNotHavingStringFormat(11);
+ }
+ }
+ }
+
+ return (result == 22);
+ }
+
+ public static bool WithoutFormatBase()
+ {
+ int result = 0;
+
+ for (int i = 0; i < Iterations; i++)
+ {
+ result |= FastFunctionNotHavingStringFormat(11);
+ }
+
+ return (result == 22);
+ }
+
+ public static bool WithFormatBase()
+ {
+ int result = 0;
+
+ for (int i = 0; i < Iterations; i++)
+ {
+ result |= FastFunctionNotCallingStringFormat(11);
+ }
+
+ return (result == 22);
+ }
+
+ public static int Main()
+ {
+ bool withFormat = WithFormatBase();
+ bool withoutFormat = WithoutFormatBase();
+
+ return (withFormat && withoutFormat ? 100 : -1);
+ }
+}
+}
+
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.csproj b/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.csproj
new file mode 100644
index 0000000000..cb3381638c
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/InlineGCStruct.csproj
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="InlineGCStruct.cs" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)benchmark\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)benchmark\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Performance/CodeQuality/Inlining/NoThrowInline.cs b/tests/src/JIT/Performance/CodeQuality/Inlining/NoThrowInline.cs
index 9b689ce376..dc05f44b33 100644
--- a/tests/src/JIT/Performance/CodeQuality/Inlining/NoThrowInline.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Inlining/NoThrowInline.cs
@@ -13,6 +13,8 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Inlining
+{
public static class NoThrowInline
{
#if DEBUG
@@ -34,7 +36,7 @@ public static class NoThrowInline
//
// We expect ThrowArgumentNullException to not be inlined into Bench, the throw code is pretty
- // large and throws are extremly slow. However, we need to be careful not to degrade the
+ // large and throws are extremly slow. However, we need to be careful not to degrade the
// non-exception path performance by preserving registers across the call. For this the compiler
// will have to understand that ThrowArgumentNullException never returns and omit the register
// preservation code.
@@ -73,3 +75,4 @@ public static class NoThrowInline
return (Bench("a", "bc", "def", "ghij") == 10) ? 100 : -1;
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/SIMD/ConsoleMandel/ConsoleMandel.cs b/tests/src/JIT/Performance/CodeQuality/SIMD/ConsoleMandel/ConsoleMandel.cs
index ed7f675700..5ab08202b6 100644
--- a/tests/src/JIT/Performance/CodeQuality/SIMD/ConsoleMandel/ConsoleMandel.cs
+++ b/tests/src/JIT/Performance/CodeQuality/SIMD/ConsoleMandel/ConsoleMandel.cs
@@ -11,9 +11,9 @@ using Xunit;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
-namespace ConsoleMandel
+namespace SIMD
{
- public static class Program
+ public static class ConsoleMandel
{
private const int Pass = 100;
private const int Fail = -1;
diff --git a/tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/RayTracerBench.cs b/tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/RayTracerBench.cs
index 064f860611..254672b462 100644
--- a/tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/RayTracerBench.cs
+++ b/tests/src/JIT/Performance/CodeQuality/SIMD/RayTracer/RayTracerBench.cs
@@ -2,8 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
-// Based on the Raytracer example from
-// Samples for Parallel Programming with the .NET Framework
+// Based on the Raytracer example from
+// Samples for Parallel Programming with the .NET Framework
// https://code.msdn.microsoft.com/windowsdesktop/Samples-for-Parallel-b4b76364
using Microsoft.Xunit.Performance;
@@ -16,6 +16,8 @@ using System.Collections.Concurrent;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace SIMD
+{
public class RayTracerBench
{
#if DEBUG
@@ -142,3 +144,4 @@ public class RayTracerBench
return (result ? 100 : -1);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.cs b/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.cs
new file mode 100644
index 0000000000..34c0ab888d
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.cs
@@ -0,0 +1,159 @@
+// 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 Microsoft.Xunit.Performance;
+using System;
+using System.Numerics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Collections.Generic;
+using Xunit;
+
+[assembly: OptimizeForBenchmarks]
+[assembly: MeasureInstructionsRetired]
+
+public static class SeekUnroll
+{
+
+ // The purpose of this micro-benchmark is to measure the effect of unrolling
+ // on this loop (taken from https://github.com/aspnet/KestrelHttpServer/pull/1138)
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static int FindByte(ref Vector<byte> byteEquals)
+ {
+ var vector64 = Vector.AsVectorInt64(byteEquals);
+ long longValue = 0;
+ var i = 0;
+ for (; i < Vector<long>.Count; i++)
+ {
+ longValue = vector64[i];
+ if (longValue == 0) continue;
+ break;
+ }
+
+ // Flag least significant power of two bit
+ var powerOfTwoFlag = (ulong)(longValue ^ (longValue - 1));
+ // Shift all powers of two into the high byte and extract
+ var foundByteIndex = (int)((powerOfTwoFlag * _xorPowerOfTwoToHighByte) >> 57);
+ // Single LEA instruction with jitted const (using function result)
+ return i * 8 + foundByteIndex;
+ }
+
+ // Magic constant used in FindByte
+ const ulong _xorPowerOfTwoToHighByte = (0x07ul |
+ 0x06ul << 8 |
+ 0x05ul << 16 |
+ 0x04ul << 24 |
+ 0x03ul << 32 |
+ 0x02ul << 40 |
+ 0x01ul << 48) + 1;
+
+ // Inner loop to repeatedly call FindByte
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static void InnerLoop(ref int foundIndex, ref Vector<Byte> vector)
+ {
+ for (int i = 0; i < InnerIterations; i++)
+ {
+ foundIndex = FindByte(ref vector);
+ }
+ }
+
+ // Iteration counts for inner loop set to have each call take 1 or
+ // 2 seconds or so in release, finish quickly in debug.
+#if DEBUG
+ const int InnerIterations = 1;
+#else
+ const int InnerIterations = 1000000000;
+#endif
+
+ // Function to meaure InnerLoop using the xunit-perf benchmark measurement facilities
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static void XunitBenchmarkLoop(ref int foundIndex, ref Vector<Byte> vector)
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ {
+ using (iteration.StartMeasurement())
+ {
+ InnerLoop(ref foundIndex, ref vector);
+ }
+ }
+ }
+
+ // Function to measure InnerLoop with manual use of a stopwatch timer
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ static void ManualTimerLoop(ref int foundIndex, ref Vector<Byte> vector)
+ {
+ for (int iteration = 0; iteration < ManualLoopTimes.Length; ++iteration)
+ {
+ var timer = System.Diagnostics.Stopwatch.StartNew();
+ InnerLoop(ref foundIndex, ref vector);
+ timer.Stop();
+ ManualLoopTimes[iteration] = timer.ElapsedMilliseconds;
+ }
+ }
+ static long[] ManualLoopTimes;
+
+ // Function that tests one input, dispatching to either the xunit-perf
+ // loop or the manual timer loop
+ static bool Test(int index, bool isXunitBenchmark)
+ {
+ if (index >= Vector<Byte>.Count)
+ {
+ // FindByte assumes index is in range
+ index = 0;
+ }
+ var bytes = new Byte[Vector<Byte>.Count];
+ bytes[index] = 255;
+ Vector<Byte> vector = new Vector<Byte>(bytes);
+
+ int foundIndex = -1;
+
+ if (isXunitBenchmark)
+ {
+ XunitBenchmarkLoop(ref foundIndex, ref vector);
+ }
+ else
+ {
+ ManualTimerLoop(ref foundIndex, ref vector);
+ }
+
+ Assert.Equal(index, foundIndex);
+ return (index == foundIndex);
+ }
+
+ // Set of indices to pass to Test(int, bool)
+ static int[] IndicesToTest = new int[] { 1, 3, 11, 19, 27 };
+
+ // Entrypoint for xunit-perf to call the benchmark
+ [Benchmark]
+ [MemberData(nameof(ArrayedBoxedIndicesToTest))]
+ public static bool Test(object boxedIndex)
+ {
+ return Test((int)boxedIndex, true);
+ }
+
+ // IndicesToTest wrapped up in arrays of boxes since that's
+ // what xunit-perf needs
+ public static IEnumerable<object[]> ArrayedBoxedIndicesToTest =
+ IndicesToTest.Select((int index) => new object[] { index });
+
+
+ // Main method entrypoint runs the manual timer loop
+ public static int Main()
+ {
+ int failures = 0;
+ foreach(int index in IndicesToTest)
+ {
+ ManualLoopTimes = new long[10];
+ bool passed = Test(index, false);
+ if (!passed)
+ {
+ ++failures;
+ }
+ Console.WriteLine("Index {0}, times (ms) [{1}]", index, String.Join(", ", ManualLoopTimes));
+ }
+
+ return 100 + failures;
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.csproj b/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.csproj
new file mode 100644
index 0000000000..53cfe42001
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/SIMD/SeekUnroll/SeekUnroll.csproj
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9AE6E18D-B3F9-4216-9809-125824387175}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="SeekUnroll.cs" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)benchmark\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)benchmark\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Performance/CodeQuality/Serialization/Deserialize.cs b/tests/src/JIT/Performance/CodeQuality/Serialization/Deserialize.cs
index b0ed00d40b..56fc2665ad 100644
--- a/tests/src/JIT/Performance/CodeQuality/Serialization/Deserialize.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Serialization/Deserialize.cs
@@ -15,6 +15,8 @@ using Microsoft.Xunit.Performance;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Serialization
+{
public class JsonBenchmarks
{
@@ -26,7 +28,7 @@ public class JsonBenchmarks
public const int JsonNetIterations = 90000;
#endif
- const string DataContractXml = @"<JsonBenchmarks.TestObject xmlns=""http://schemas.datacontract.org/2004/07/"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><Id>33</Id><Name>SqMtx</Name><Results xmlns:a=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><a:double>101.3</a:double><a:double>99.8</a:double><a:double>99.6</a:double><a:double>100.4</a:double></Results><WhenRun>2015-01-01T00:00:00-08:00</WhenRun></JsonBenchmarks.TestObject>";
+ const string DataContractXml = @"<JsonBenchmarks.TestObject xmlns=""http://schemas.datacontract.org/2004/07/Serialization"" xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""><Id>33</Id><Name>SqMtx</Name><Results xmlns:a=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><a:double>101.3</a:double><a:double>99.8</a:double><a:double>99.6</a:double><a:double>100.4</a:double></Results><WhenRun>2015-01-01T00:00:00-08:00</WhenRun></JsonBenchmarks.TestObject>";
const string DataContractJson = @"{""Id"":33,""Name"":""SqMtx"",""Results"":[101.3,99.8,99.6,100.4],""WhenRun"":""\/Date(1420099200000-0800)\/""}";
@@ -83,7 +85,7 @@ public class JsonBenchmarks
}
[Benchmark]
- private void DeserializeDataContract()
+ private void DeserializeDataContract()
{
foreach (var iteration in Benchmark.Iterations) {
using (iteration.StartMeasurement()) {
@@ -199,3 +201,4 @@ public class JsonBenchmarks
return result ? 100 : -1;
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Serialization/Serialize.cs b/tests/src/JIT/Performance/CodeQuality/Serialization/Serialize.cs
index 905cf56584..39ab5876c9 100644
--- a/tests/src/JIT/Performance/CodeQuality/Serialization/Serialize.cs
+++ b/tests/src/JIT/Performance/CodeQuality/Serialization/Serialize.cs
@@ -14,6 +14,8 @@ using Microsoft.Xunit.Performance;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
+namespace Serialization
+{
public class JsonBenchmarks
{
@@ -72,7 +74,7 @@ public class JsonBenchmarks
}
[Benchmark]
- private void SerializeDataContract()
+ private void SerializeDataContract()
{
foreach (var iteration in Benchmark.Iterations) {
using (iteration.StartMeasurement()) {
@@ -186,3 +188,4 @@ public class JsonBenchmarks
return result ? 100 : -1;
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs b/tests/src/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs
index 23eab8db5b..620e012848 100644
--- a/tests/src/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs
+++ b/tests/src/JIT/Performance/CodeQuality/V8/Crypto/Crypto.cs
@@ -46,7 +46,7 @@ using System.Globalization;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
-namespace Crypto
+namespace V8.Crypto
{
public class Support
{
diff --git a/tests/src/JIT/Performance/CodeQuality/V8/DeltaBlue/DeltaBlue.cs b/tests/src/JIT/Performance/CodeQuality/V8/DeltaBlue/DeltaBlue.cs
index ee14b8b1b1..27f77182b2 100644
--- a/tests/src/JIT/Performance/CodeQuality/V8/DeltaBlue/DeltaBlue.cs
+++ b/tests/src/JIT/Performance/CodeQuality/V8/DeltaBlue/DeltaBlue.cs
@@ -24,13 +24,15 @@ using System.Collections;
[assembly: OptimizeForBenchmarks]
[assembly: MeasureInstructionsRetired]
-/*
+/*
Strengths are used to measure the relative importance of constraints.
New strengths may be inserted in the strength hierarchy without
disrupting current constraints. Strengths cannot be created outside
this class, so pointer comparison can be used for value comparison.
*/
+namespace V8
+{
internal class Strength
{
private int _strengthValue;
@@ -1066,3 +1068,4 @@ public class deltablue
throw new Exception(s);
}
}
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/V8/Richards/Richards.cs b/tests/src/JIT/Performance/CodeQuality/V8/Richards/Richards.cs
index 6d26593e2f..5095d22ad7 100644
--- a/tests/src/JIT/Performance/CodeQuality/V8/Richards/Richards.cs
+++ b/tests/src/JIT/Performance/CodeQuality/V8/Richards/Richards.cs
@@ -20,7 +20,7 @@ using System.Collections.Generic;
// using System.Diagnostics;
// using System.Text.RegularExpressions;
-namespace Richards
+namespace V8.Richards
{
/// <summary>
/// Support is used for a place to generate any 'miscellaneous' methods generated as part
@@ -501,7 +501,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
TaskControlBlock run(Packet packet)
{
@@ -521,7 +521,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
String toString()
{
@@ -548,7 +548,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
TaskControlBlock run(Packet packet)
{
@@ -568,7 +568,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
String toString()
{
@@ -598,7 +598,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
TaskControlBlock run(Packet packet)
{
@@ -630,7 +630,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
String toString()
{
@@ -658,7 +658,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
TaskControlBlock run(Packet packet)
{
@@ -700,7 +700,7 @@ namespace Richards
public
#if !INTF_FOR_TASK
- override
+ override
#endif
String toString()
{