Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make is_sub_path faster#17962

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hauntsaninja merged 5 commits intopython:masterfromhauntsaninja:faster-subpath
Oct 17, 2024
Merged

Conversation

@hauntsaninja
Copy link
Collaborator

@hauntsaninjahauntsaninja commentedOct 15, 2024
edited
Loading

See#17948

  • 1.01x faster on clean
  • 1.06x faster on long
  • 1.04x faster on openai
  • 1.26x faster on openai incremental

Seepython#17948Haven't run the benchmark yet, but profile indicates that this couldsave 0.5s on both incremental and non-incremental builds in environmentswith long search path
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

"""Given two paths, return if path is a sub-path of dir."""
ifnotdir.endswith(os.sep):
dir+=os.sep
returnpath.startswith(dir)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this will work reliably on Windows, where path separators can be/ or\, and these are largely equivalent? Should we normalize separators on Windows, or can we assume everything is normalized here? I noticed that you added a call toos.path.normcase, so maybe this is already ok.

Maybe update docstring to mention Windows-specific issues, and case insensitivity issues?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Documented the shortcomings of the faster function + invariants we require in modulefinder. Also renamed the function so it sounds a little scarier

@github-actions
Copy link
Contributor

According tomypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninjahauntsaninja merged commitc201a18 intopython:masterOct 17, 2024
@hauntsaninjahauntsaninja deleted the faster-subpath branchOctober 17, 2024 01:52
hauntsaninja added a commit that referenced this pull requestOct 20, 2024
See#17948- 1.01x faster on clean- 1.06x faster on long- 1.04x faster on openai- 1.26x faster on openai incremental
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JukkaLJukkaLJukkaL left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@hauntsaninja@JukkaL

[8]ページ先頭

©2009-2025 Movatter.jp