-
-
Notifications
You must be signed in to change notification settings - Fork 290
Delay astroid_bootstrapping()
until instantiating AstroidBuilder
#2210
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
Delay astroid_bootstrapping()
until instantiating AstroidBuilder
#2210
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2210 +/- ##
=======================================
Coverage 92.68% 92.69%
=======================================
Files 94 94
Lines 10828 10835 +7
=======================================
+ Hits 10036 10043 +7
Misses 792 792
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, 4 Time faster ? Or at least 2 times ? Not sure if I read the data corectly. It seems you did not have to add lazy anything inside the astroid manager either ? I'm going to check if that's yet another way to make it faster in the future once I'm not on mobile. Exciting change either ways ! The impact will be enormous when pylint is launched in parallele on small files by an external tool like pre-commit !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it make more sense for the bootstrapping to occur when AstroidManager
is created? Its name (to me) implies that I would be responsible for this instead of the Builder
.
This would create an infinite loop, since calling astroid/astroid/raw_building.py Lines 597 to 602 in 1fbbf25
astroid/astroid/raw_building.py Lines 423 to 431 in 1fbbf25
Also, I like the idea of keeping this guard closer to what it actually needs to guard--the building of the stdlib ast by the Builder. |
Sounds fine! Thanks for explaining. |
Just tested the changes and it look like it's almost 3 time faster, this is great work ! |
Type of Changes
Description
Reduce time to
import astroid
by delayingastroid_bootstrapping()
until the first instantiation ofAstroidBuilder
.Closes #2161
Benchmark
main@ 4493399
pr