Skip to content

Conversation

@IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Dec 21, 2025

Problem

TagBot was experiencing severe performance issues:

  1. Annotated tag resolution: For repos with many existing tags, _commit_sha_of_tag() was called per-version, resolving every annotated tag via an API call (e.g., 625 API calls for 625 versions)
  2. Tree lookup for non-PR registries: Custom registries without JuliaRegistrator PRs fell back to _commit_sha_of_tree(), which iterates O(branches × commits) via API calls

Solution

  1. Dict lookup for tag existence: Check version_tag in tags_cache (O(1)) instead of calling _commit_sha_of_tag() which resolves annotated tags

  2. Tree→commit cache: Build a cache using git log --all --format=%H %T once, then do O(1) lookups instead of iterating through commits via API

Performance Impact

Scenario Before After
All tags exist (625 versions, annotated) ~282s, 625+ API calls ~few seconds, 1 API call
Non-PR registry, new versions O(branches × commits) API calls per version Single git log + O(1) lookups

Changes

  • Check tag existence via dict lookup instead of calling _commit_sha_of_tag()
  • Add _build_tree_to_commit_cache() using git log --all --format=%H %T
  • Replace _commit_sha_of_tree() implementation with cache-based O(1) lookup
  • Lazy PR cache loading (only built when first version needs registry PR lookup)
  • Add debug logging for tree lookup fallback

- Check tag existence via dict lookup instead of calling _commit_sha_of_tag()
- This avoids resolving annotated tags (which requires an API call per tag)
- Add tree→commit cache using 'git log --all --format=%H %T' for O(1) lookups
- Replaces O(branches × commits) API iteration with single git command
- Keep _commit_sha_of_tree fallback for versions without registry PRs

Co-authored-by: Claude <noreply@anthropic.com>
@IanButterworth IanButterworth changed the title Fix slow tag checking by avoiding annotated tag resolution Fix slow tag checking and tree lookups for non-PR registries Dec 21, 2025
@IanButterworth IanButterworth merged commit e6dd665 into master Dec 21, 2025
2 checks passed
@IanButterworth IanButterworth deleted the ib/even_faster_still branch December 21, 2025 04:56
@IanButterworth
Copy link
Member Author

lol...

Version check complete: 0 new versions found (checked 625 total versions in 1.37s)

was this earlier

Performance: 628 API calls, 4 PRs checked, 625 versions processed, 2051.14s elapsed

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.

2 participants