History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ANTLR-218
Type: Improvement Improvement
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Terence Parr
Reporter: Terence Parr
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
ANTLR v3

antlr got slower?

Created: 11/Feb/08 09:52 AM   Updated: 05/May/08 06:06 PM
Component/s: analysis
Affects Version/s: 3.0.1
Fix Version/s: 3.1


 Description  « Hide
Hi,

ANTLR is great. I am really happy that it can compile my grammar.

My favourite pre-release is antlr-2007-12-31.14. antlr-2007-12-31.14
is more than 10 times faster than the antlr-2007-12-31.17 pre-release
and all subsequent pre-releases up to the latest I could download
antlr-2008-02-05.15 (fisheye never works for me).

My ANTLR grammar is slightly over 2000 lines, the generated parser is
about 2.7 MB:

goanna% wc Tntdbo.g TntdboParser.java
   2134 4975 79049 Tntdbo.g
  46561 117928 2681755 TntdboParser.java
  48695 122903 2760804 total
goanna%

Times for antlr to compile it with java 1.5.0_14-b03 on a 2.8 GHz
Opteron are:

25416 ms - antlr-2007-12-31.14 - love this pre-release!
405494 ms - antlr-2008-02-05.15 - its great that it compiles it!

The grammar has 149 dis-ambiguating semantic predicates, no other
predicates. There is no use of ANTLR backtracking.

Thanks, Mark

antlr-2007-12-31.14
-------------------

gmake p
java -Xmx512m
-classpath /h/goanna/2/eng/dev/tntdbo/java_src:/h/goanna/2/eng/dev/tntdbo:/h/goanna/2/ts/antlr/antlr-2007-12-31.14/lib/antlr-2007-12-31.14.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.14/lib/runtime-2007-12-31.14.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.14/lib/stringtemplate-3.1b1.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.14/lib/antlr-2.7.7.jar
org.antlr.Tool -Xconversiontimeout 600000 -report Tntdbo.g ANTLR Parser
Generator Version 3.1b1 (??) 1989-2007 ANTLR Grammar Report; Stats
Version 4 Grammar: Tntdbo Type: combined
Target language: Java
Output: AST
Grammar option k: none
Grammar option backtrack: false
Rules: 193
Productions: 484
Decisions: 266
Cyclic DFA decisions: 0
LL(1) decisions: 167
Min fixed k: -1
Max fixed k: 5
Average fixed k: 0.462406015037594
Standard deviation of fixed k: 1.060658499894118
Min acyclic DFA states: 0
Max acyclic DFA states: 88
Average acyclic DFA states: 8.101503759398497
Standard deviation of acyclic DFA states: 15.430948979548202
Total acyclic DFA states: 2155
Min cyclic DFA states: 0
Max cyclic DFA states: 0
Average cyclic DFA states: 0.0
Standard deviation of cyclic DFA states: 0.0
Total cyclic DFA states: 0
Vocabulary size: 297
DFA creation time in ms: 25416
Number of semantic predicates found: 149
Number of manual fixed lookahead k=value options: 68
Number of nondeterministic decisions: 109
Number of nondeterministic decisions resolved with predicates: 109
Number of DFA conversions terminated early: 0
Number of errors: 0
Number of warnings: 0
Number of infos: 0
Number of syntactic predicates found: 0
Decisions with syntactic predicates: 0
Decision DFAs using syntactic predicates: 0
Decisions with semantic predicates: 69
Decision DFAs using semantic predicates: 109

Backtracking report:
Number of decisions that backtrack: 0

NFA conversion early termination report:
Number of NFA conversions that terminated early: 0

rm -f TntdboParser.java.orig
mv TntdboParser.java TntdboParser.java.orig
sed -f sed_fix_dot_tree.sed TntdboParser.java.orig
TntdboParser.java.missing_right_curly_brace cat
TntdboParser.java.missing_right_curly_brace
missing_right_curly_brace.txt >TntdboParser.java

Compilation finished at Tue Feb 12 00:36:39

--

antlr-2008-02-05.15
-------------------

-*- mode: compilation; default-directory:
"/h/goanna/2/eng/dev/tntdbo/java_src/tntdbo/dboc/" -*- Compilation
started at Tue Feb 12 00:50:28

gmake p
java -Xmx512m
-classpath /h/goanna/2/eng/dev/tntdbo/java_src:/h/goanna/2/eng/dev/tntdbo:/h/goanna/2/ts/antlr/antlr-2008-02-05.15/lib/antlr-2008-02-05.15.jar:/h/goanna/2/ts/antlr/antlr-2008-02-05.15/lib/runtime-2008-02-05.15.jar:/h/goanna/2/ts/antlr/antlr-2008-02-05.15/lib/stringtemplate-3.1b1.jar:/h/goanna/2/ts/antlr/antlr-2008-02-05.15/lib/antlr-2.7.7.jar
org.antlr.Tool -Xconversiontimeout 600000 -report Tntdbo.g ANTLR Parser
Generator Version 3.1b1 (??) 1989-2007 ANTLR Grammar Report; Stats
Version 4 Grammar: Tntdbo Type: combined
Target language: Java
Output: AST
Grammar option k: none
Grammar option backtrack: false
Rules: 193
Productions: 484
Decisions: 266
Cyclic DFA decisions: 0
LL(1) decisions: 167
Min fixed k: -1
Max fixed k: 5
Average fixed k: 0.462406015037594
Standard deviation of fixed k: 1.060658499894118
Min acyclic DFA states: 0
Max acyclic DFA states: 88
Average acyclic DFA states: 8.101503759398497
Standard deviation of acyclic DFA states: 15.430948979548202
Total acyclic DFA states: 2155
Min cyclic DFA states: 0
Max cyclic DFA states: 0
Average cyclic DFA states: 0.0
Standard deviation of cyclic DFA states: 0.0
Total cyclic DFA states: 0
Vocabulary size: 297
DFA creation time in ms: 405494
Number of semantic predicates found: 149
Number of manual fixed lookahead k=value options: 68
Number of nondeterministic decisions: 109
Number of nondeterministic decisions resolved with predicates: 109
Number of DFA conversions terminated early: 0
Number of errors: 0
Number of warnings: 0
Number of infos: 1
Number of syntactic predicates found: 0
Decisions with syntactic predicates: 0
Decision DFAs using syntactic predicates: 0
Decisions with semantic predicates: 69
Decision DFAs using semantic predicates: 109

Backtracking report:
Number of decisions that backtrack: 0

NFA conversion early termination report:
Number of NFA conversions that terminated early: 0


Compilation finished at Tue Feb 12 00:57:27


--


--------------------------------------------------------------------

On Mon, 11 Feb 2008 16:19:40 +0100
Johannes Luber <jaluber@gmx.de> wrote:

Mark Wright schrieb:
Hi,

ANTLR is great. I am really happy that it can compile my grammar.

My favourite pre-release is antlr-2007-12-31.14.
antlr-2007-12-31.14 is more than 10 times faster than the
antlr-2007-12-31.17 pre-release and all subsequent pre-releases up
to the latest I could download antlr-2008-02-05.15 (fisheye never
works for me).

Do I interpret correctly, that later prereleases didn't have any
speed-up? Or they had a speed-up, but not as fast one the last 2007
release?

Johannes

Hello Johannes,

antlr-2007-12-28.10 was the first pre-release that can compile my
grammar. I just tried ANTLR 3.0.1, it runs for 6 minutes before
running out of heap space with -Xmx512m.

So yes: antlr-2007-12-28.10 to antlr-2007-12-31.14 were really great
pre-releases, they compile my grammar faster that ANTLR 3.0.1 and
current pre-releases:

25416 ms - antlr-2007-12-31.14 - love this pre-release!
361301 ms - antlr-2007-12-31.17 - first release with the change.
405494 ms - antlr-2008-02-05.15 - its great that it compiles it.

There is a comment added to the CHANGES.TXT file between the
antlr-2007-12-31.14 and antlr-2007-12-31.17 pre-releases:

goanna% diff -wc antlr-2007-12-31.14/CHANGES.txt
antlr-2007-12-31.17/CHANGES.txt *** antlr-2007-12-31.14/CHANGES.txt
Tue Jan 1 09:03:10 2008 --- antlr-2007-12-31.17/CHANGES.txt Tue
Jan 1 12:10:04 2008 ***************
*** 10,15 ****
--- 10,24 ----

 December 31, 2007

+ * Added the start of a semantic predicate computation for LL(1) to solve
+ a problem with slow grammar analysis even with k=1 due to predicates.
+ Then I realized the problem with that grammar was elsewhere.
+ Semantic context really shouldn't be used when preventing closure
+ recomputation. The predicates became huge even though the reduced
+ value would be no different. The analyzer seems faster now that
+ I am not testing predicate values all the time. Further it may
+ terminate sooner just due to reduced closure recursion.
+
 * Moved FIRST/FOLLOW computations to a separate class LL1Analyzer to
   tidy up.

goanna%

I was crazy enough to be working on my grammar on New Years Eve as well.

The output for antlr-2007-12-31.17 pre-release is below, the outputs
for antlr-2007-12-31.14 and antlr-2008-02-05.15 were in my last email.

Thanks, Mark

Compilation started at Tue Feb 12 02:42:17

antlr-2007-12-31.17
-------------------

gmake p
java -Xmx512m
-classpath /h/goanna/2/eng/dev/tntdbo/java_src:/h/goanna/2/eng/dev/tntdbo:/h/goanna/2/ts/antlr/antlr-2007-12-31.17/lib/antlr-2007-12-31.17.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.17/lib/runtime-2007-12-31.17.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.17/lib/stringtemplate-3.1b1.jar:/h/goanna/2/ts/antlr/antlr-2007-12-31.17/lib/antlr-2.7.7.jar
org.antlr.Tool -Xconversiontimeout 600000 -report Tntdbo.g ANTLR Parser
Generator Version 3.1b1 (??) 1989-2007 ANTLR Grammar Report; Stats
Version 4 Grammar: Tntdbo Type: combined
Target language: Java
Output: AST
Grammar option k: none
Grammar option backtrack: false
Rules: 193
Productions: 484
Decisions: 266
Cyclic DFA decisions: 0
LL(1) decisions: 167
Min fixed k: -1
Max fixed k: 5
Average fixed k: 0.462406015037594
Standard deviation of fixed k: 1.060658499894118
Min acyclic DFA states: 0
Max acyclic DFA states: 88
Average acyclic DFA states: 8.101503759398497
Standard deviation of acyclic DFA states: 15.430948979548202
Total acyclic DFA states: 2155
Min cyclic DFA states: 0
Max cyclic DFA states: 0
Average cyclic DFA states: 0.0
Standard deviation of cyclic DFA states: 0.0
Total cyclic DFA states: 0
Vocabulary size: 297
DFA creation time in ms: 361301
Number of semantic predicates found: 149
Number of manual fixed lookahead k=value options: 68
Number of nondeterministic decisions: 109
Number of nondeterministic decisions resolved with predicates: 109
Number of DFA conversions terminated early: 0
Number of errors: 0
Number of warnings: 0
Number of infos: 0
Number of syntactic predicates found: 0
Decisions with syntactic predicates: 0
Decision DFAs using syntactic predicates: 0
Decisions with semantic predicates: 69
Decision DFAs using semantic predicates: 109

Backtracking report:
Number of decisions that backtrack: 0

NFA conversion early termination report:
Number of NFA conversions that terminated early: 0


Compilation finished at Tue Feb 12 02:48:32


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.