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:33:10 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X f28c64d78 -> 3ecb690a0


Increase the default value of cache threshold

(cherry picked from commit 6a36b73)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 3ecb690a022f53afcd5ccb3d8fd020846825b5c6
Parents: f28c64d
Author: sunlan <sunlan@apache.org>
Authored: Mon Aug 21 21:32:23 2017 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Mon Aug 21 21:33:01 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/3ecb690a/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 b000f5b..45c7a33 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