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

Re: [PATCH 00/20] pack-revindex: prepare for on-disk reverse index

From
Derrick Stolee <stolee@gmail.com>
Date
Jan 11, 2021, 12:07 UTC
Message-ID
<75ba9979-1a1f-de9f-c2cc-1433d30ed09d@gmail.com>
In-Reply-To
<cover.1610129796.git.me@ttaylorr.com>

On 1/8/2021 1:16 PM, Taylor Blau wrote: ...

Show 6 quoted lines
>   - First, a new API is proposed.
> 
>   - Then, uses of the old API are removed one by one and replaced with their
>     new counterparts.
> 
>   - Finally, without any callers remaining, the old API is removed.
This patch series has a clear layout that was easy to follow.

In a vacuum, the conversions from immediate struct member lookups to API calls seems like adding overhead to something that is done frequently in a loop. However, you do justify it:

Show 12 quoted lines
> Generating the reverse index in memory for repositories with large packs has two
> significant drawbacks:
> 
>   - It requires allocating sizeof(struct revindex_entry) per packed object.
> 
>   - It requires us to sort the entries by their pack offset. This is implemented
>     in sort_revindex() using a radix sort, but still takes considerable time (as
>     benchmarks found in the second series demonstrate).
> 
> Both of these can be addressed by storing the reverse index in a new '.rev' file
> alongside the packs. This file is written once (during pack creation), and does
> not require sorting when accessed, since it is stored in a sorted order.

Even if these method calls do add a bit of overhead to each access, it helps to not compute the table from scratch before any access is possible.

This will be particularly valuable for operations that use only a few position lookups, such as "is object A reachable from commit C?"

Operations that iterate through every object in a bitmap are more likely to notice a difference, but that will probably be visible in the next series.

My comments on this series are very minor.

I made only one comment about "if (method() < 0)" versus "if (method())" but that pattern appears in multiple patches. _If_ you decide to change that pattern, then I'm sure you can find all uses.

Reviewed-by: Derrick Stolee <dstolee@microsoft.com>

Thanks, -Stolee

Previous: Taylor BlauNext: Taylor Blau
Message 61 of 121 in “pack-revindex: prepare for on-disk reverse index”
  1. 00/20 pack-revindex: prepare for on-disk reverse indexTaylor Blau, Jan 8, 2021
  2. 01/20 pack-revindex: introduce a new APITaylor Blau, Jan 8, 2021
  3. Jeff KingJan 12, 2021
  4. Jeff KingJan 12, 2021
  5. Taylor BlauJan 12, 2021
  6. Junio C HamanoJan 13, 2021
  7. Junio C HamanoJan 13, 2021
  8. Jeff KingJan 13, 2021
  9. Taylor BlauJan 13, 2021
  10. 02/20 write_reuse_object(): convert to new revindex APITaylor Blau, Jan 8, 2021
  11. Jeff KingJan 12, 2021
  12. Taylor BlauJan 12, 2021
  13. Jeff KingJan 13, 2021
  14. 03/20 write_reused_pack_one(): convert to new revindex APITaylor Blau, Jan 8, 2021
  15. Jeff KingJan 12, 2021
  16. Taylor BlauJan 12, 2021
  17. 04/20 write_reused_pack_verbatim(): convert to new revindex APITaylor Blau, Jan 8, 2021
  18. Jeff KingJan 12, 2021
  19. 06/20 bitmap_position_packfile(): convert to new revindex APITaylor Blau, Jan 8, 2021
  20. 08/20 get_size_by_pos(): convert to new revindex APITaylor Blau, Jan 8, 2021
  21. 07/20 show_objects_for_type(): convert to new revindex APITaylor Blau, Jan 8, 2021
  22. Jeff KingJan 12, 2021
  23. Taylor BlauJan 12, 2021
  24. 05/20 check_object(): convert to new revindex APITaylor Blau, Jan 8, 2021
  25. Derrick StoleeJan 11, 2021
  26. Taylor BlauJan 11, 2021
  27. Jeff KingJan 12, 2021
  28. Jeff KingJan 12, 2021
  29. 11/20 get_delta_base_oid(): convert to new revindex APITaylor Blau, Jan 8, 2021
  30. 12/20 retry_bad_packed_offset(): convert to new revindex APITaylor Blau, Jan 8, 2021
  31. 16/20 builtin/gc.c: guess the size of the revindexTaylor Blau, Jan 8, 2021
  32. Derrick StoleeJan 11, 2021
  33. Taylor BlauJan 11, 2021
  34. Derrick StoleeJan 11, 2021
  35. Jeff KingJan 12, 2021
  36. 15/20 for_each_object_in_pack(): convert to new revindex APITaylor Blau, Jan 8, 2021
  37. 10/20 rebuild_existing_bitmaps(): convert to new revindex APITaylor Blau, Jan 8, 2021
  38. 09/20 try_partial_reuse(): convert to new revindex APITaylor Blau, Jan 8, 2021
  39. Jeff KingJan 12, 2021
  40. Taylor BlauJan 12, 2021
  41. 13/20 packed_object_info(): convert to new revindex APITaylor Blau, Jan 8, 2021
  42. Jeff KingJan 12, 2021
  43. Taylor BlauJan 12, 2021
  44. 14/20 unpack_entry(): convert to new revindex APITaylor Blau, Jan 8, 2021
  45. Jeff KingJan 12, 2021
  46. Taylor BlauJan 12, 2021
  47. 18/20 pack-revindex: remove unused 'find_revindex_position()'Taylor Blau, Jan 8, 2021
  48. Derrick StoleeJan 11, 2021
  49. Taylor BlauJan 11, 2021
  50. Derrick StoleeJan 11, 2021
  51. Jeff KingJan 12, 2021
  52. Taylor BlauJan 12, 2021
  53. Jeff KingJan 13, 2021
  54. 19/20 pack-revindex: hide the definition of 'revindex_entry'Taylor Blau, Jan 8, 2021
  55. Derrick StoleeJan 11, 2021
  56. Jeff KingJan 12, 2021
  57. 17/20 pack-revindex: remove unused 'find_pack_revindex()'Taylor Blau, Jan 8, 2021
  58. 20/20 pack-revindex.c: avoid direct revindex access in 'offset_to_pack_pos()'Taylor Blau, Jan 8, 2021
  59. Jeff KingJan 12, 2021
  60. Taylor BlauJan 12, 2021
  61. Derrick StoleeJan 11, 2021
  62. Taylor BlauJan 11, 2021
  63. Derrick StoleeJan 11, 2021
  64. Taylor BlauJan 11, 2021
  65. Junio C HamanoJan 11, 2021
  66. Jeff KingJan 12, 2021
  67. Taylor BlauJan 12, 2021
  68. Junio C HamanoJan 13, 2021
  69. Taylor BlauJan 13, 2021
  70. Junio C HamanoJan 13, 2021
  71. Taylor BlauJan 13, 2021
  72. Junio C HamanoJan 13, 2021
  73. Jeff KingJan 13, 2021
  74. Taylor BlauJan 13, 2021
  75. Junio C HamanoJan 13, 2021
  76. Taylor BlauJan 13, 2021
  77. Jeff KingJan 13, 2021
  78. 00/20 pack-revindex: prepare for on-disk reverse indexTaylor Blau, Jan 13, 2021
  79. 03/20 write_reused_pack_one(): convert to new revindex APITaylor Blau, Jan 13, 2021
  80. 01/20 pack-revindex: introduce a new APITaylor Blau, Jan 13, 2021
  81. Junio C HamanoJan 14, 2021
  82. Derrick StoleeJan 14, 2021
  83. Taylor BlauJan 14, 2021
  84. Jeff KingJan 14, 2021
  85. Junio C HamanoJan 14, 2021
  86. 20/20 pack-revindex.c: avoid direct revindex access in 'offset_to_pack_pos()'Taylor Blau, Jan 13, 2021
  87. Junio C HamanoJan 14, 2021
  88. Taylor BlauJan 14, 2021
  89. 09/20 try_partial_reuse(): convert to new revindex APITaylor Blau, Jan 13, 2021
  90. 15/20 for_each_object_in_pack(): convert to new revindex APITaylor Blau, Jan 13, 2021
  91. Junio C HamanoJan 14, 2021
  92. Taylor BlauJan 14, 2021
  93. Jeff KingJan 14, 2021
  94. Jeff KingJan 14, 2021
  95. Taylor BlauJan 14, 2021
  96. Junio C HamanoJan 15, 2021
  97. Taylor BlauJan 15, 2021
  98. Junio C HamanoJan 14, 2021
  99. 13/20 packed_object_info(): convert to new revindex APITaylor Blau, Jan 13, 2021
  100. 16/20 builtin/gc.c: guess the size of the revindexTaylor Blau, Jan 13, 2021
  101. Junio C HamanoJan 14, 2021
  102. Taylor BlauJan 14, 2021
  103. Jeff KingJan 14, 2021
  104. 19/20 pack-revindex: hide the definition of 'revindex_entry'Taylor Blau, Jan 13, 2021
  105. 17/20 pack-revindex: remove unused 'find_pack_revindex()'Taylor Blau, Jan 13, 2021
  106. 10/20 rebuild_existing_bitmaps(): convert to new revindex APITaylor Blau, Jan 13, 2021
  107. 07/20 show_objects_for_type(): convert to new revindex APITaylor Blau, Jan 13, 2021
  108. 11/20 get_delta_base_oid(): convert to new revindex APITaylor Blau, Jan 13, 2021
  109. 12/20 retry_bad_packed_offset(): convert to new revindex APITaylor Blau, Jan 13, 2021
  110. 14/20 unpack_entry(): convert to new revindex APITaylor Blau, Jan 13, 2021
  111. 18/20 pack-revindex: remove unused 'find_revindex_position()'Taylor Blau, Jan 13, 2021
  112. Junio C HamanoJan 14, 2021
  113. 08/20 get_size_by_pos(): convert to new revindex APITaylor Blau, Jan 13, 2021
  114. 04/20 write_reused_pack_verbatim(): convert to new revindex APITaylor Blau, Jan 13, 2021
  115. 06/20 bitmap_position_packfile(): convert to new revindex APITaylor Blau, Jan 13, 2021
  116. 02/20 write_reuse_object(): convert to new revindex APITaylor Blau, Jan 13, 2021
  117. 05/20 check_object(): convert to new revindex APITaylor Blau, Jan 13, 2021
  118. Jeff KingJan 14, 2021
  119. Junio C HamanoJan 14, 2021
  120. Jeff KingJan 15, 2021
  121. Jeff KingJan 15, 2021

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.