From 5d436c4ee3351aeb0e1394f291e2294ab83314c1 Mon Sep 17 00:00:00 2001 From: Levi Broderick Date: Mon, 5 Mar 2018 18:12:51 -0800 Subject: [PATCH] Use InnerIterationCount for perf tests Commit migrated from https://github.com/dotnet/corefx/commit/b729933bd04197953e9e921c8e557c557ad654b1 --- .../System.Memory/tests/Performance/Perf.Span.Clear.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Memory/tests/Performance/Perf.Span.Clear.cs b/src/libraries/System.Memory/tests/Performance/Perf.Span.Clear.cs index 167603d9b2862..65179cd1f80bf 100644 --- a/src/libraries/System.Memory/tests/Performance/Perf.Span.Clear.cs +++ b/src/libraries/System.Memory/tests/Performance/Perf.Span.Clear.cs @@ -9,7 +9,9 @@ namespace System.Memory.Tests { public class Perf_Span_Clear { - [Benchmark] + private const int NumIters = 10000; + + [Benchmark(InnerIterationCount = NumIters)] [InlineData(0)] [InlineData(1)] [InlineData(2)] @@ -41,7 +43,7 @@ public void Int(int size) { using (iteration.StartMeasurement()) { - for (int i = 0; i < 10000; i++) + for (int i = 0; i < Benchmark.InnerIterationCount; i++) { span.Clear(); } @@ -49,7 +51,7 @@ public void Int(int size) } } - [Benchmark] + [Benchmark(InnerIterationCount = NumIters)] [InlineData(0)] [InlineData(1)] [InlineData(2)] @@ -81,7 +83,7 @@ public void References(int size) { using (iteration.StartMeasurement()) { - for (int i = 0; i < 10000; i++) + for (int i = 0; i < Benchmark.InnerIterationCount; i++) { span.Clear(); }