8000 Optimize `validate_sha()` with `--max-count=1` by aloisklink · Pull Request #111 · python/cherry-picker · GitHub
[go: up one dir, main page]

Skip to content

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
@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

0