From f5294204ae74e441615e38adb1d1c23fc9c09c3b Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Sun, 21 Apr 2013 15:00:20 -0500 Subject: [PATCH] Add the TestPerformance.MAX_FILES_PER_PARSE_ITERATION configuration field --- tool/test/org/antlr/v4/test/TestPerformance.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tool/test/org/antlr/v4/test/TestPerformance.java b/tool/test/org/antlr/v4/test/TestPerformance.java index 002e2ee9e..edcdfe227 100644 --- a/tool/test/org/antlr/v4/test/TestPerformance.java +++ b/tool/test/org/antlr/v4/test/TestPerformance.java @@ -111,6 +111,10 @@ public class TestPerformance extends BaseTest { * {@link #TOP_PACKAGE}. */ private static final boolean RECURSIVE = true; + /** + * The maximum number of files to parse in a single iteration. + */ + private static final int MAX_FILES_PER_PARSE_ITERATION = Integer.MAX_VALUE; /** * {@code true} to call {@link Collections#shuffle} on the list of input @@ -445,10 +449,16 @@ public class TestPerformance extends BaseTest { long startTime = System.currentTimeMillis(); tokenCount.set(0); int inputSize = 0; + int inputCount = 0; Collection> results = new ArrayList>(); ExecutorService executorService = Executors.newFixedThreadPool(NUMBER_OF_THREADS, new NumberedThreadFactory()); for (final CharStream input : sources) { + inputCount++; + if (inputCount > MAX_FILES_PER_PARSE_ITERATION) { + break; + } + input.seek(0); inputSize += input.size(); Future futureChecksum = executorService.submit(new Callable() {