name-hash: precompute hash values during preload-index

Precompute the istate.name_hash and istate.dir_hash values
for each cache-entry during the preload-index phase.

Move the expensive memihash() calculations from lazy_init_name_hash()
to the multi-threaded preload-index phase.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler
2016-11-17 09:59:59 -05:00
committed by Johannes Schindelin
parent d484faac20
commit d27bd052d2
4 changed files with 85 additions and 2 deletions

16
cache.h
View File

@@ -173,6 +173,9 @@ struct cache_entry {
unsigned int ce_flags;
unsigned int ce_namelen;
unsigned int index; /* for link extension */
unsigned int precompute_hash_state;
unsigned int precompute_hash_name;
unsigned int precompute_hash_dir;
struct object_id oid;
char name[FLEX_ARRAY]; /* more */
};
@@ -229,6 +232,19 @@ struct cache_entry {
#error "CE_EXTENDED_FLAGS out of range"
#endif
/*
* Bit set if preload-index precomputed the hash value(s)
* for this cache-entry.
*/
#define CE_PRECOMPUTE_HASH_STATE__SET (1 << 0)
/*
* Bit set if precompute-index also precomputed the hash value
* for the parent directory.
*/
#define CE_PRECOMPUTE_HASH_STATE__DIR (1 << 1)
void precompute_istate_hashes(struct cache_entry *ce);
/* Forward structure decls */
struct pathspec;
struct child_process;