问题
I have some doubts regarding the performance of Antlr4.
- I am currently using Python with Antlr4. It is terribly slow compared to Java (Verified using Antlr4 IntelliJ plugin). Since I need to work with bigger codes for parsing, I am planning to switch to a language which will be the fastest with Antlr (Eg: Java, C or Python). Any suggestions?
- Any tips on optimizing the Antlr grammar for faster parsing (I am trying some online resources)
- If I continue with Python itself, what are the best ways to speed up parsing? (Note: There is a suggestion in this link to use the antlr4 available in https://github.com/antlr/antlr4/pull/1010 for speed up). Has anybody tried it?
UPDATE
- Using Antlr 4.7.1 from the github repo helped me in speeding up the parsing process in Python. (The parsing which took more than 3 hours and still unfinished with Antlr 4.5 which came with Ubuntu 16.04 got completed in 25 min or so when I used Antlr 4.7.1 from github repo)
来源:https://stackoverflow.com/questions/53653323/what-are-the-ways-to-speed-up-parsing-in-antlr4