Re: [RFC/PATCH 0/8] Add configuration options for split-index
From: Duy Nguyen <hidden>
Date: 2016-07-25 16:05:31
On Sat, Jul 23, 2016 at 6:11 PM, Christian Couder [off-list ref] wrote:
Ok, I started working on automatically pushing back all changes to the shared index when the percentage of entries in linked vs shared indexes is greater than 25% (maybe I will make it configurable later). It is very basic and doesn't work well for now (for one thing it is missing added entries), see: https://github.com/chriscool/git/commits/config-split-index8 Basically I would like a way to count then entries that are only in the linked index without modifying them to be safe, but I have a hard time seeing how I could modify prepare_to_write_split_index() to get that.
Hmm.. can you do the counting separately? A shared cache_entry must have its field "index" greater than zero. By counting the number of entries whose index is zero (i.e. not shared) against the total number of real (*) entries, you should have a decent estimate when to split. Then you can do exactly what "git update-index --no-split-index" and "git update-index --split-index" sequence does, but in write_index(). It's easier than messing inside split-index.c. If we hit performance problem, then we can look into changing split-index.c (*) remember that some entries may be marked CE_REMOVE, which are dead entries and should not be counted because they will never be written down on disk. -- Duy