-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extremely Poor Performance Parsing PHP #1873
Comments
Could you add a file or link of your simple 80-line program? I'll take a look. C# version of grammar works fairly fast. |
It is in the |
|
It parsed less than a 0.5 sec on C# SHarwerll runtime. Unfortunately, I'm not working with Python runtime and can not help you. Maybe it's related to bugs and defects in Python runtime. |
Hi, |
@ericvergnaud is there something inherently different between the way Python runtime works and the C# runtime? I struggle to believe that everything is working as expected when it takes 0.5s with C# and 24s with Python. What inside the runtime would cause it to be so slow in Python, but not in C#? |
The tests demonstrate that everything works as expected. |
I started digging into the profile a bit:
This spark any ideas with anyone? |
You will see a very similar profile in Java and C# i.e. most of the time is spent in ParserATNSimulator. |
I built the lexer and parser from the grammars repo for PHP and I get extremely poor performance (~3s to lex, and 24s to parse) with a simple 80 line PHP program (taken from the Wordpress repo). A simple example of this performance issue can be found here: https://github.com/wspeirs/php_linter
I read the previous posts (#944, #1243) about performance issues and have:
BailErrorStrategy
PredictionMode.SLL
I'm using Python 3.5 on Linux, and ANTLR4.7:
I'm hoping there is just a "make go faster" flag I'm missing somewhere, and I don't have to re-work the entire grammar (especially seeing as how I didn't make it) or that I just found a nasty bug in ANTLR4.
Thanks!
The text was updated successfully, but these errors were encountered: