git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/6] Retain caches of submodule refs

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Aug 12, 2011, 22:36 UTC
Message-ID
<1313188589-2330-1-git-send-email-mhagger@alum.mit.edu>
...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
Next: Michael Haggerty
Message 1 of 54 in “Retain caches of submodule refs”
  1. 0/6 Retain caches of submodule refsMichael Haggerty, Aug 12, 2011
  2. 1/6 Extract a function clear_cached_refs()Michael Haggerty, Aug 12, 2011
  3. 2/6 Access reference caches only through new function get_cached_refs().Michael Haggerty, Aug 12, 2011
  4. Junio C HamanoAug 14, 2011
  5. Michael HaggertyAug 23, 2011
  6. 3/6 Change the signature of read_packed_refs()Michael Haggerty, Aug 12, 2011
  7. 4/6 Allocate cached_refs objects dynamicallyMichael Haggerty, Aug 12, 2011
  8. Junio C HamanoAug 14, 2011
  9. 5/6 Store the submodule name in struct cached_refs.Michael Haggerty, Aug 12, 2011
  10. 6/6 Retain caches of submodule refsMichael Haggerty, Aug 12, 2011
  11. Heiko VoigtAug 13, 2011
  12. Michael HaggertyAug 24, 2011
  13. Heiko VoigtAug 24, 2011
  14. Junio C HamanoAug 16, 2011
  15. Michael HaggertyAug 24, 2011
  16. Michael HaggertyOct 9, 2011
  17. Junio C HamanoOct 9, 2011
  18. 0/2 Provide API to invalidate refs cacheMichael Haggerty, Oct 10, 2011
  19. 1/2 invalidate_cached_refs(): take the submodule as parameterMichael Haggerty, Oct 10, 2011
  20. 2/2 invalidate_cached_refs(): expose this function in refs APIMichael Haggerty, Oct 10, 2011
  21. 0/7 Provide API to invalidate refs cacheMichael Haggerty, Oct 10, 2011
  22. 1/7 invalidate_ref_cache(): rename function from invalidate_cached_refs()Michael Haggerty, Oct 10, 2011
  23. Junio C HamanoOct 11, 2011
  24. Michael HaggertyOct 11, 2011
  25. 2/7 invalidate_ref_cache(): take the submodule as parameterMichael Haggerty, Oct 10, 2011
  26. 3/7 invalidate_ref_cache(): expose this function in refs APIMichael Haggerty, Oct 10, 2011
  27. 4/7 clear_cached_refs(): rename parameterMichael Haggerty, Oct 10, 2011
  28. 5/7 clear_cached_refs(): extract two new functionsMichael Haggerty, Oct 10, 2011
  29. 6/7 write_ref_sha1(): only invalidate the loose ref cacheMichael Haggerty, Oct 10, 2011
  30. 7/7 clear_cached_refs(): inline functionMichael Haggerty, Oct 10, 2011
  31. Junio C HamanoOct 11, 2011
  32. Michael HaggertyOct 11, 2011
  33. Julian PhillipsOct 11, 2011
  34. Junio C HamanoOct 11, 2011
  35. 0/7 Provide API to invalidate refs cacheMichael Haggerty, Oct 12, 2011
  36. 1/7 invalidate_ref_cache(): rename function from invalidate_cached_refs()Michael Haggerty, Oct 12, 2011
  37. Junio C HamanoOct 12, 2011
  38. Michael HaggertyOct 12, 2011
  39. 2/7 invalidate_ref_cache(): take the submodule as parameterMichael Haggerty, Oct 12, 2011
  40. Junio C HamanoOct 12, 2011
  41. Michael HaggertyOct 12, 2011
  42. Junio C HamanoOct 17, 2011
  43. Michael HaggertyNov 3, 2011
  44. Junio C HamanoNov 3, 2011
  45. 3/7 invalidate_ref_cache(): expose this function in refs APIMichael Haggerty, Oct 12, 2011
  46. 4/7 clear_cached_refs(): rename parameterMichael Haggerty, Oct 12, 2011
  47. 5/7 clear_cached_refs(): extract two new functionsMichael Haggerty, Oct 12, 2011
  48. 6/7 write_ref_sha1(): only invalidate the loose ref cacheMichael Haggerty, Oct 12, 2011
  49. 7/7 clear_cached_refs(): inline functionMichael Haggerty, Oct 12, 2011
  50. Junio C HamanoOct 12, 2011
  51. Heiko VoigtOct 10, 2011
  52. Michael HaggertyOct 11, 2011
  53. Heiko VoigtOct 11, 2011
  54. Heiko VoigtAug 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.