You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/06/25 04:16:46 UTC

[groovy] 01/01: GROOVY-9588: groovyCompile 6x slower in 3.0.4 than 2.5.6

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY-9588
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 384e699f95bbd04ff234d4ecc83b35ed0e162b25
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Jun 25 12:14:42 2020 +0800

    GROOVY-9588: groovyCompile 6x slower in 3.0.4 than 2.5.6
    
    Antlr4 can not report missing token smartly as antlr2 does, so it have to use error alternatives, but which may impact the parsing performance a lot if the error alternative matches nothing.
---
 src/antlr/GroovyParser.g4 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 47b212c..05fc5d2 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -1256,9 +1256,8 @@ keywords
 
 rparen
     :   RPAREN
-    |
-        // !!!Error Alternative, impact the performance of parsing
-        { require(false, "Missing ')'"); }
+    |   r=~RPAREN // !!!Error Alternative
+        { require(false, "Missing ')'", -$r.text.length()); }
     ;
 
 nls