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

Re: [PATCH v2 0/6] pack-objects: create new name-hash algorithm

From
Derrick Stolee <stolee@gmail.com>
Date
Sep 18, 2024, 23:30 UTC
Message-ID
<b2ad8d6f-ad66-4ca4-8b27-8e5450306c99@gmail.com>
In-Reply-To
<pull.1785.v2.git.1726692381.gitgitgadget@gmail.com>
On 9/18/24 4:46 PM, Derrick Stolee via GitGitGadget wrote:
...
 > Other things that have happened include investigations into ways to adapt
 > the full-name hash to improve upon the name-hash. I did some experimenting
 > with increasing the size of 'struct object_entry' by using a 64-bit hash
 > value (name-hash, then full-name-hash) for a single-pass compression or two
 > 32-bit hash values for a two-pass compression process. I include my WIP
 > branch at [3] to show what I tried, though the single-pass option did not
 > present any improvements and the two-pass option seems to be broken to the
 > point that the compression is substantially worse. (I'll try to elaborate on
 > this in a reply to this cover letter.)
 >
 > [3] 
https://github.com/derrickstolee/git/compare/full-name...derrickstolee:git:full-name-wip
To break down what I attempted in [3], let me break down a few things.

First, I tried using a 64-bit hash value [1]. This used the standard name-hash as the most-significant digits and the full-name-hash as the least-significant digits. The goal here was to still have locality from the name-hash but get a good partition based on full-name-hash within those collisions.

However, when sorting this way, the boundaries of the full-name-hash partitions are ineffective at getting good delta bases because the largest object from one full-name-hash set is next to the smallest object from the next full-name-hash set. Even when a full-name-hash set has size one, it is sorted roughly randomly among the other colliding path names instead of grouped nicely with objects of a similar size. This makes the results nearly identical to the 32-bit full-name-hash implementation.

[1] https://github.com/derrickstolee/git/commit/aaa6befa3016667ea5eb10fdd6aa2b7fcec3a52e

Second, I tried storing two 32-bit hashes and doing a two-pass delta search [2]. In theory, this should be very similar to the --path-walk feature from the RFC. However, I failed to make it work. Something about this version of a two-pass walk was hitting some strange behavior. For example, I had to put in this extra condition [4] if a best delta base was not found, or else we could get a segfault.

[2] https://github.com/derrickstolee/git/commit/bf71271040ab93a624a8cdf5bc8aaff68e9b1b17

[4] https://github.com/derrickstolee/git/commit/fedc4fc543e50563f4748a5ffc45b51b530023e0

In fact, the results were not just _bad_ but they were _significantly worse_.

It took me a long time to report these details because they just didn't make sense and I couldn't figure out what was going wrong. I'd be very grateful to anyone who could explore these WIP commits and point out what I'm doing wrong so I can learn and maybe we can get a boost to the feature.

Even if we had strong data from these examples, I'm not sure that we'd want to add four bytes per object to the packing data, especially in a way that impacts users that aren't even using the new feature. We would want to explore options that use some kind of hashtable to map objects to their 64-bit hash values, perhaps. It also affects the .bitmap file format, which would need modification even for a new 32-bit hash function (though one of the same size could be used by adding an extension saying "I'm using hash function v2" and leave the rest of the structure the same).

I would also like to test the performance against the threaded version of the --path-walk feature, which I recently got working in my prototype branch [5].

[5] https://github.com/derrickstolee/git/pull/28/commits/a9fc233390ae00e3d4b156be64d6b3974e30d8a1

Thanks, -Stolee

Previous: Derrick StoleeNext: Junio C Hamano
Message 34 of 38 in “pack-objects: create new name-hash algorithm”
  1. 0/4 pack-objects: create new name-hash algorithmDerrick Stolee via GitGitGadget, Sep 9, 2024
  2. 1/4 pack-objects: add --full-name-hash optionDerrick Stolee via GitGitGadget, Sep 9, 2024
  3. Junio C HamanoSep 9, 2024
  4. Derrick StoleeSep 10, 2024
  5. 2/4 git-repack: update usage to match docsDerrick Stolee via GitGitGadget, Sep 9, 2024
  6. Junio C HamanoSep 9, 2024
  7. 3/4 p5313: add size comparison testDerrick Stolee via GitGitGadget, Sep 9, 2024
  8. 4/4 p5314: add a size test for name-hash collisionsDerrick Stolee via GitGitGadget, Sep 9, 2024
  9. Derrick StoleeSep 9, 2024
  10. Junio C HamanoSep 9, 2024
  11. Derrick StoleeSep 10, 2024
  12. Taylor BlauSep 10, 2024
  13. Derrick StoleeSep 10, 2024
  14. Jeff KingSep 11, 2024
  15. Junio C HamanoSep 10, 2024
  16. Junio C HamanoSep 10, 2024
  17. Derrick StoleeSep 10, 2024
  18. 0/6 pack-objects: create new name-hash algorithmDerrick Stolee via GitGitGadget, Sep 18, 2024
  19. 1/6 pack-objects: add --full-name-hash optionDerrick Stolee via GitGitGadget, Sep 18, 2024
  20. Junio C HamanoSep 19, 2024
  21. 2/6 repack: test --full-name-hash optionDerrick Stolee via GitGitGadget, Sep 18, 2024
  22. Junio C HamanoSep 19, 2024
  23. 3/6 pack-objects: add GIT_TEST_FULL_NAME_HASHDerrick Stolee via GitGitGadget, Sep 18, 2024
  24. Junio C HamanoSep 19, 2024
  25. Derrick StoleeSep 23, 2024
  26. 4/6 git-repack: update usage to match docsDerrick Stolee via GitGitGadget, Sep 18, 2024
  27. 5/6 p5313: add size comparison testDerrick Stolee via GitGitGadget, Sep 18, 2024
  28. Junio C HamanoSep 19, 2024
  29. Derrick StoleeSep 23, 2024
  30. Junio C HamanoSep 23, 2024
  31. 6/6 test-tool: add helper for name-hash valuesDerrick Stolee via GitGitGadget, Sep 18, 2024
  32. Patrick SteinhardtSep 24, 2024
  33. Derrick StoleeSep 25, 2024
  34. Derrick StoleeSep 18, 2024
  35. Junio C HamanoOct 4, 2024
  36. Taylor BlauOct 4, 2024
  37. Jeff KingOct 4, 2024
  38. Derrick StoleeOct 8, 2024

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.