-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Speed up case sensitive is-file check in file system cache #10093
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
Conversation
This speeds up resolving imports somewhat. Add fast paths to `isfile_case`. On Linux we skip all logic, since the file system is almost always case sensitive. Cache results of parent directories as well. Add tests.
mypy/test/testfscache.py
Outdated
self.make_file('bar.py') | ||
self.make_file('pkg/sub_package/__init__.py') | ||
self.make_file('pkg/sub_package/foo.py') | ||
# Run twice to test bost cached and non-cached code paths. |
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.
Typo "bost"
assert self.isfile_case('pkg/sub_package/__init__.py') | ||
assert self.isfile_case('pkg/sub_package/foo.py') | ||
assert not self.isfile_case('non_existent.py') | ||
assert not self.isfile_case('pkg/non_existent.py') |
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.
Maybe add a third test case where you check the two intermingled? For example:
- cold case-sensitive
- cold case-insensitive
- warm case-sensitive
- warm case-insensitive
mypy/test/testfscache.py
Outdated
self.make_file('bar.py') | ||
self.make_file('pkg/sub_package/__init__.py') | ||
self.make_file('pkg/sub_package/foo.py') | ||
# Run twice to test bost cached and non-cached code paths. |
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.
same typo here.
Originally added in python#10093 Fixes python#11690, fixes python#10661, fixes python#10822
Originally added in python#10093 Fixes python#11690, fixes python#10661, fixes python#10822 Co-authored-by: hauntsaninja <>
This speeds up resolving imports somewhat.
Add fast paths to
isfile_case
. On Linux we skip all logic, sincethe file system is almost always case sensitive.
Cache results of parent directories as well.
Add tests.