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

Speed up case sensitive is-file check in file system cache #10093

Merged
merged 3 commits into from
Feb 15, 2021

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Feb 15, 2021

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.

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.
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.
Copy link
Member

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')
Copy link
Member

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

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.
Copy link
Member

Choose a reason for hiding this comment

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

same typo here.

@JukkaL JukkaL merged commit a21e5e1 into master Feb 15, 2021
@JukkaL JukkaL deleted the daemon-fast-imports-1 branch February 15, 2021 19:24
hauntsaninja pushed a commit to hauntsaninja/mypy that referenced this pull request Dec 10, 2021
JukkaL pushed a commit that referenced this pull request Dec 13, 2021
Originally added in #10093

Fixes #11690, fixes #10661, fixes #10822

Co-authored-by: hauntsaninja <>
tushar-deepsource pushed a commit to DeepSourceCorp/mypy that referenced this pull request Jan 20, 2022
Originally added in python#10093

Fixes python#11690, fixes python#10661, fixes python#10822

Co-authored-by: hauntsaninja <>
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.

2 participants