--
--
There is a unit test “TestPerformance” which is highly configurable and designed for use with the Java parser. You can test with the LR (new style) or standard (old style) Java grammars, and have many options to control the behavior. I recommend the following initial configuration to gauge the performance on your input files:
· Set the JDK_SOURCE_ROOT environment variable or Java property (passed to the VM with the -D flag) to the root folder containing the source files you’d like to parse.
· Set the TOP_PACKAGE field in TestPerformance to the top-level package you’d like to parse. If this is the empty string, then all packages under the JDK_SOURCE_ROOT (recursively) will be parsed for the test.
· Set TestPerformance.COMPUTE_CHECKSUM to false.
The test loads all source files into memory so variations in drive speed do not affect the test results. You also have easy access to:
· Multiple parsing strategies, including SLL/LL and the hybrid two-stage parsing technique
· Single- and multi-threaded parsing evaluation
· Statistics concerning DFA size
· The ability to compensate results for JIT overhead during startup and normalize for GC overhead
· The ability to independently evaluate overhead of constructing a parse tree on the overall process
· The ability to independently evaluate overhead of running a (blank) listener over the resulting parse tree
· Control over the DFA caches (preserve throughout the test, flush after each pass, or flush after every file)
https://github.com/antlr/antlr4/blob/master/tool/test/org/antlr/v4/test/TestPerformance.java
The grammars used for this test are “Java-LR.g4” and “Java.g4” in this folder:
https://github.com/antlr/antlr4/tree/master/tool/test/org/antlr/v4/test
--
--