groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Increase the default value of cache threshold
Date Mon, 21 Aug 2017 13:32:34 GMT
Repository: groovy
Updated Branches:
  refs/heads/master cde8d15f9 -> 6a36b736d


Increase the default value of cache threshold


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6a36b736
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6a36b736
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6a36b736

Branch: refs/heads/master
Commit: 6a36b736deab157854a94ebb393ed1fb4b381ff0
Parents: cde8d15
Author: sunlan <sunlan@apache.org>
Authored: Mon Aug 21 21:32:23 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Aug 21 21:32:23 2017 +0800

----------------------------------------------------------------------
 .../apache/groovy/parser/antlr4/internal/AtnManager.java    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6a36b736/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/internal/AtnManager.java
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/internal/AtnManager.java
b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/internal/AtnManager.java
index 11dfdb5..b7975f6 100644
--- a/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/internal/AtnManager.java
+++ b/subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/internal/AtnManager.java
@@ -23,8 +23,6 @@ import org.apache.groovy.parser.antlr4.GroovyLangLexer;
 import org.apache.groovy.parser.antlr4.GroovyLangParser;
 import org.apache.groovy.util.Maps;
 
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -38,6 +36,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 public class AtnManager {
     public static final ReentrantReadWriteLock RRWL = new ReentrantReadWriteLock(true);
     private static final String CACHE_THRESHOLD_NAME = "groovy.antlr4.cache.threshold";
+    private static final int DEFAULT_CACHE_THRESHOLD = 100;
     private static final int CACHE_THRESHOLD;
     private final Class ownerClass;
     private final ATN atn;
@@ -47,13 +46,13 @@ public class AtnManager {
     );
 
     static {
-        int t = 50;
+        int t = DEFAULT_CACHE_THRESHOLD;
 
         try {
             t = Integer.parseInt(System.getProperty(CACHE_THRESHOLD_NAME));
 
-            // cache threshold should be at least 50 for better performance
-            t = t < 50 ? 50 : t;
+            // cache threshold should be at least DEFAULT_CACHE_THRESHOLD for better performance
+            t = t < DEFAULT_CACHE_THRESHOLD ? DEFAULT_CACHE_THRESHOLD : t;
         } catch (Exception e) {
             // ignored
         }


Mime
View raw message