Skip to content
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

Cache find_module calls #2543

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

correctmost
Copy link
Contributor

Type of Changes

Type
βœ“ πŸ”¨ Refactoring

Description

This PR speeds up the linting of codebases with lots of imports like yt-dlp.

Stats

Before

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    63840    0.702    0.000    3.424    0.000 astroid/interpreter/_import/spec.py:129(find_module)
    38635    0.057    0.000    1.358    0.000 astroid/interpreter/_import/spec.py:287(find_module)
    38635    0.056    0.000    0.711    0.000 astroid/interpreter/_import/spec.py:224(find_module)
    38635    0.052    0.000    1.774    0.000 astroid/interpreter/_import/spec.py:263(find_module)
Command Mean [s] Min [s] Max [s] Relative
pylint --recursive=y . 32.063 Β± 0.137 31.820 32.287 1.00

After

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    18166    0.226    0.000    1.194    0.000 astroid/interpreter/_import/spec.py:129(find_module)
     6689    0.013    0.000    0.629    0.000 astroid/interpreter/_import/spec.py:225(find_module)
     6689    0.011    0.000    0.278    0.000 astroid/interpreter/_import/spec.py:290(find_module)
     6689    0.009    0.000    0.311    0.000 astroid/interpreter/_import/spec.py:265(find_module)
Command Mean [s] Min [s] Max [s] Relative
pylint --recursive=y . 30.058 Β± 0.142 29.917 30.283 1.00

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 93.24%. Comparing base (71f5c0c) to head (a01c9da).
Report is 75 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2543      +/-   ##
==========================================
+ Coverage   92.98%   93.24%   +0.26%     
==========================================
  Files          93       93              
  Lines       11047    11060      +13     
==========================================
+ Hits        10272    10313      +41     
+ Misses        775      747      -28     
Flag Coverage Ξ”
linux 93.13% <100.00%> (+0.27%) ⬆️
pypy 93.24% <100.00%> (+0.26%) ⬆️
windows 93.24% <100.00%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Ξ”
astroid/interpreter/_import/spec.py 97.58% <100.00%> (+0.08%) ⬆️
astroid/manager.py 89.95% <100.00%> (+0.12%) ⬆️

... and 59 files with indirect coverage changes

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@correctmost
Copy link
Contributor Author

Any further changes required for this PR? Thanks!

@Pierre-Sassoulas
Copy link
Member

Thank you for the reminder. I think it's fine, I prefer to have a second maintainer's opinion on some MR if possible though :) And I forgot to add a milestone so we didn't merge it for the 3.3.0 release.

@jacobtylerwalls jacobtylerwalls merged commit a8439ff into pylint-dev:main Oct 23, 2024
20 checks passed
@correctmost correctmost deleted the cm/cache-find-module branch October 23, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants