Skip to content

Fix slow tag ancestors#472

Merged
taylorsilva merged 1 commit into
concourse:masterfrom
C85297:fix-slow-match-tag-ancestors
May 5, 2026
Merged

Fix slow tag ancestors#472
taylorsilva merged 1 commit into
concourse: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

linux-foundation-easycla Bot commented Apr 27, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: C85297 / name: C85297 (54f24bc)

@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
@C85297
Copy link
Copy Markdown
Contributor Author

C85297 commented May 5, 2026

@taylorsilva Think the CLA should be sorted now 👍

@taylorsilva
Copy link
Copy Markdown
Member

Awesome! Pulling in and I'll get it into a release.

@taylorsilva taylorsilva merged commit 03fd6d3 into concourse:master May 5, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting on Contributor to Done in Pull Requests May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants