Skip to content

Fix slow tag ancestors#472

Open
C85297 wants to merge 1 commit intoconcourse:masterfrom
C85297:fix-slow-match-tag-ancestors
Open

Fix slow tag ancestors#472
C85297 wants to merge 1 commit intoconcourse:masterfrom
C85297:fix-slow-match-tag-ancestors

Conversation

@C85297
Copy link
Copy Markdown
Contributor

@C85297 C85297 commented Apr 27, 2026

In #437 I added the match_tag_ancestors feature to return commits that were ancestors of matching tags.

That initial implementation turned out to be poorly optimised, and in large repos with many tags and many commits, a nested loop over each commit and each tag becomes very slow.

This pull request optimises the match_tag_ancestors feature:

  1. Rather than resolving the commit each tag targets inside each loop iteration, each tag is resolved to its commit once, before the loop.
  2. Check for commits that match one of the already resolved tag targets and instantly return
  3. For all other commits, use git tag --contains to get a list of tags the commit is an ancestor of, and check if any of those tags match the eligible tags we're looking for.

My testing showed around 100x less subprocesses spawned and 40x faster check runs.

@C85297 C85297 requested a review from a team as a code owner April 27, 2026 07:49
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@C85297
Copy link
Copy Markdown
Contributor Author

C85297 commented Apr 27, 2026

It seems EasyCLA will require me to get a corporate CLA approval completed, this may take a while :/

@taylorsilva taylorsilva moved this from Todo to Waiting on Contributor in Pull Requests Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on Contributor

Development

Successfully merging this pull request may close these issues.

2 participants