-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
Type inference performance issue #579
Comments
The inference result of
It looks like inference is (correctly?) inferencing all possible permutations of the list:
Not too sure what to do about this |
Is this an actual example of something that can happen in the wild or is just an artificial example? I wonder if we'd need to introduce some sort of recursion guard in the inference, that will stop after a certain amount of recursive inferred branches. This should prevent a couple of performance issues where we'd try to infer all the potential values that a complex function could generate, although I'm not yet exactly sure on how the mechanics would work for that guard. |
Yes, this is an actual example which happened a few days ago. It appeared in a function which takes takes a setting dictionary and constructs the command line arguments for a monitoring plugin. Basically one commit increased the pylint running time of our project from about 0:30 h to 5:30 h. |
Ouch, that's quite the jump! Curious how big your project in terms of LOC is if it already takes half an hour without this bug. |
According to cloc roughly 2000 Python files with 250000 lines of code. Without this issue and a bit of tuning it's now down to 0:10 h again. |
Just for clarification: Spell checking in pylint seems to take ages, so we took out the checks |
I think we could open an issue on pylint for that performance problem @PCManticore |
@brycepg Good catch, that might work! |
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close pylint-dev#579 Close pylint-dev/pylint#2251
spot performance issues. Add new envrionment variable call ASTROID_MAX_INFERABLE to tune the max inferable amount of values at a time. Close #579 Close pylint-dev/pylint#2251
In pylint 1.9.2 astroids type inference performs very badly for the code below:
If the
args.append('')
appears in the first if statement pylint finishes almost immediately. If you move it to the end it already takes more than 7s. Profiling shows that the running time and number of calls to the function_infer_binary_operation
increases exponentiallyThe issue can be reproduced in a virtual environment with only pylint installed and an empty pylintrc.
The text was updated successfully, but these errors were encountered: