Skip to content

Conversation

@iczero
Copy link
Contributor

@iczero iczero commented Nov 7, 2025

worktree_branches opens every worktree as a Repository to resolve its HEAD. This is currently getting called in the loop over ref mappings, but I do not see why it needs to be. Moving it outside the loop results in a pretty significant performance increase (~10x in my case) for fetch when worktree(s) are present, dependent on how many refs exist in the repository and the value configured for object_store_slots. In my case, object_store_slots was set relatively high, resulting in slow drop for gix_odb::Store and hence gix::Repository.

@iczero iczero changed the title Move worktree_branches call out of loop in fetch Move worktree_branches call out of loop in ref update Nov 7, 2025
@Byron
Copy link
Member

Byron commented Nov 7, 2025

Thanks so much, a great catch!

For a moment I was surprised that this worktree mapping is mutable, but it seems that it only sorts the worktree directories which indeed is idempotent in this context.

@Byron Byron merged commit c3beb20 into GitoxideLabs:main Nov 7, 2025
28 checks passed
@iczero iczero deleted the fetch-performance-fix branch November 7, 2025 03:56
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