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

Optimize validate_sha() with --max-count=1 #111

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

aloisklink
Copy link
Contributor

Optimize the validate_sha() function with --max-count=1 to prevent printing the git log of every single commit. See the "Commit Limiting" section of git-log's man page

This makes the function near instant.

Currently, running time git log main > /dev/null takes about ~1s second for me on the CPython repo, while time git log --max-count=1 main > /dev/null (with or without the -r flag) only takes about 0.003s.

Additionally, if you've cloned the CPython repo using a blobless clone (e.g. with git clone --filter=blob:none https://github.com/python/cpython.git), doing a git log -r takes a very long time (almost an hour for me on a slow internet connection!), since the -r flag seems to force downloading a blob for every single commit, which makes a blobless clone kind of useless.

Optimize the `validate_sha()` function with `--max-count=1` to prevent
printing the git log of every single commit.

This makes the function near instant.
@AA-Turner AA-Turner merged commit 45e0d09 into python:main Jan 30, 2024
22 checks passed
@aloisklink aloisklink deleted the perf/optimize-validate_sha branch January 30, 2024 09:16
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