-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Long lines of spaces cause exponential runtime #4062
Comments
Thanks for the report. There seems to be an issue in the formatting checkers. |
Similar to issue #4041 I would not consider this enhancement/topic-performance. In a CI/CD setting such long runtimes are equivalent to non-termination. |
I did quick profile and it seems that majority of time is spent in tokenize module.
|
I have doublechecked the tokenizer and it seems that there is root cause of the issue:
btw. there were optimizations done lately in tokenize.py - maybe can be checked against python master: |
I have checked this both on Looking at my own profiler output and that reported by @matusvalo I see similar results although my machine is clearly faster. @jkrinke I'm not sure if you're still interested in this issue but could you report back how long your example takes on the latest Otherwise I think we could close this issue as it might have been solved with improvements to the Profiler output: 951656 function calls (940963 primitive calls) in 3.528 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
4 1.648 0.412 1.650 0.413 tokenize.py:429(_tokenize)
128 0.225 0.002 0.225 0.002 {built-in method builtins.compile}
482 0.218 0.000 0.218 0.000 {method 'match' of 're.Pattern' objects}
381 0.181 0.000 0.181 0.000 {method 'read' of '_io.BufferedReader' objects}
23 0.145 0.006 0.146 0.006 {built-in method _imp.create_dynamic}
1685 0.086 0.000 0.086 0.000 {built-in method posix.stat}
379 0.070 0.000 0.070 0.000 {built-in method io.open_code} |
I'm going to close as completed, |
Any line that consists of spaces will take exponential runtime over the length of the line. Extremely long lines will take forever to process.
Steps to reproduce
By varying the length one can observe that the runtime doubles every 100 spaces or so.
Current behavior
pylint's runtime is larger than 24h
Expected behavior
pylint's runtime should be sub-second.
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.9.1 (default, Jan 2 2021, 18:55:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
The text was updated successfully, but these errors were encountered: