Hash :
ad7a51d8
Author :
Date :
2021-10-07T13:26:52
refs: Speed up packed lookups. Currently ref lookups require loading the entire packed-refs file into a hashmap in memory. For repos with large numbers of refs this can be painfully slow. This patch replaces the existing lookup code and instead mmap()'s the packed-refs file and performs a binary search to locate the ref entry. Git uses a similiar approach. The old hash table codepath is still used for unsorted packed-refs files. This patch also fixes a minor bug where the "peeled" trait is never parsed correctly from the packed-refs header.
# pack-refs with: peeled fully-peeled sorted
36060c58702ed4c2a40832c51758d5344201d89a refs/remotes/origin/master
41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9 refs/remotes/origin/packed
5b5b025afb0b4c913b4c338a42934a3863bf3644 refs/tags/v0.9
0c37a5391bbff43c37f0d0371823a5509eed5b1d refs/tags/v1.0
^5b5b025afb0b4c913b4c338a42934a3863bf3644