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

vcs detection could be faster #7162

Closed
TonyBeswick opened this issue Oct 8, 2019 · 1 comment
Closed

vcs detection could be faster #7162

TonyBeswick opened this issue Oct 8, 2019 · 1 comment

Comments

@TonyBeswick
Copy link
Contributor

#7072 has highlighted that the current approach to detecting which vcs tool to use for editable packages could be made faster.

Currently the method used by VcsSupport.get_backend_for_dir() is:

The subprocess call to the vcs tool takes some time. Calling hg appears to be a little slower than calling git (on my widows machine).
git rev-parse takes around 60mS
hg identify takes around 130mS

Perhaps it would be preferable to avoid (where possible) calling each vcs tool until the correct one is found. Rather using directory inspection for ALL vcs types first and falling back to calling vcs tools if inspection finds nothing.

With this in mind, would the following be a better approach for VcsSupport.get_backend_for_dir()?

  • Search every directory up the directory tree for a .git/.hg/.svn/.bzr directory.
    • if one is found then assume that is the vcs type, i.e if .git directory is found then vcs is assumed to be git without calling the vcs tool.
  • If no .git/.hg/.svn/.bzr directory is found, then call each vcs tool that implements controls_location() until one reports that it controls the location.

Another optimization: Make the order of vcs tools deterministic, putting the most popular tools first. Currently they are kept in a dict, so the order that they are tried can vary from system to system.

@pradyunsg
Copy link
Member

Closing this out since based off of #10119, there's limited interest in doing something like this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2023
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants