Re: [PATCH v7 7/9] config: make `delta_base_cache_limit` a non-global variable
From: karthik nayak <hidden>
Date: 2024-11-21 13:10:26
Attachments
- signature.asc [application/pgp-signature] 690 bytes
From: karthik nayak <hidden>
Date: 2024-11-21 13:10:26
Taylor Blau [off-list ref] writes:
On Mon, Nov 11, 2024 at 12:14:07PM +0100, Karthik Nayak wrote:quoted
@@ -1697,6 +1701,9 @@ void *unpack_entry(struct repository *r, struct packed_git *p, off_t obj_offset, struct unpack_entry_stack_ent *delta_stack = small_delta_stack; int delta_stack_nr = 0, delta_stack_alloc = UNPACK_ENTRY_STACK_PREALLOC; int base_from_cache = 0; + unsigned long delta_base_cache_limit = DEFAULT_DELTA_BASE_CACHE_LIMIT; + + repo_config_get_ulong(r, "core.deltabasecachelimit", &delta_base_cache_limit); write_pack_access_log(p, obj_offset);Hmm. This repo_config_get_ulong() call will look for the configset entry in a hashmap which is faster than parsing the configuration file from scratch every time, but still expensive for my taste in a function as hot as unpack_entry().
Thanks for pointing out, I do have not much idea about the object database code, so any input here is appreciated.
Should this also go in the_repository->settings instead? That way we have a single field access instead of a hashmap lookup (with multiple layers of function calls between us and the actual lookup).
I think that is the best way, though we'll have to still add the config to the gc config struct. Since there is no repository available there, but I think it still gets us one step closer towards cleaner config.
Thanks, Taylor