Re: Question About Sorting the Index
- From
Jon Forrest <nobozo@gmail.com>
- Date
- May 27, 2025, 16:38 UTC
- Message-ID
- <9befdb3e-ff6e-4416-8735-1eea99dbbf01@gmail.com>
- In-Reply-To
- <xmqqfrh3qe2w.fsf@gitster.g>
On 5/17/25 11:36 AM, Junio C Hamano wrote:
> For example, the fact that the index is first read into core, each > entry is represented as a cache_entry in-core structure, and the > code accesses them via an array active_cache[], and that array is > sorted per pathnames, haven't changed.
I had a thought. What if the in-memory cache were stored in a hash, where the pathname is the key? That way nothing would have to be sorted in order to lookup a particular file.
The on-disk index could be in any order.
I don't know how the overhead of creating the hash when a git program starts compares to that of creating the cache_entry struct and then later doing the sorting. This seems like the key question.
Jon