...and work towards storing refs hierarchically. Currently, the refs for submodules are put into a cache when accessed but the cache is never reused. Whenever the refs for a submodule are accessed, the cache is cleared and refilled, even if the submodule cache already contains data for that submodule. Essentially, the submodule cache only controls the lifetime of the data structures. The main module is currently stored in a separate cache that is reused properly. This patch series institutes proper caching of submodule refs: maintain a linked list of caches for each submodule, and add a new entry whenever the refs for a new submodule are accessed. Also store the cache for the main project in the same linked list for uniformity. This change accomplishes two things: * Proper caching of submodule refs. I'm not sure whether this is a significant win by itself; it depends on the usage patterns and I'm not too familiar with how submodules are used. But it seems pretty clear that this is an improvement on the old kludge. * It is a first step towards storing refs hierarchically *within* modules. My plan is to build out "struct cached_refs" into a hierarchical data structure mimicking the reference namespace hierarchy, with one cached_ref instance for each "directory" of refs. Then (the real goal) change the code to only populate the parts of the cache hierarchy that are actually accessed. I believe that this change is useful by itself, self-contained, and ready to be committed. I plan to build the hierarchical-refs changes on top of it. But if it is preferred, I can submit this series plus the hierarchical-refs patches as a single patch series (once the latter is done, which will still take some time). This patch series applies on top of "next" rather than "master" because it would otherwise conflict with the changes made by js/ref-namespaces. I am on vacation and don't know when I will have internet access, so please don't be offended if I don't respond quickly to feedback. Michael Haggerty (6): Extract a function clear_cached_refs() Access reference caches only through new function get_cached_refs(). Change the signature of read_packed_refs() Allocate cached_refs objects dynamically Store the submodule name in struct cached_refs. Retain caches of submodule refs refs.c | 106 ++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 73 insertions(+), 33 deletions(-) -- 1.7.6.8.gd2879 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html