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

Re: [PATCH] describe: use khash in finish_depth_computation()

From
Jeff King <peff@peff.net>
Date
Sep 4, 2025, 11:22 UTC
Message-ID
<20250904112255.GB2474144@coredump.intra.peff.net>
In-Reply-To
<aeb6aa64-c2f8-4b28-a2cf-9662907b5feb@web.de>
On Wed, Sep 03, 2025 at 06:30:57PM +0200, René Scharfe wrote:
Show 12 quoted lines
> On 8/25/25 9:34 AM, Jeff King wrote:
> > 
> > [oidset instead of khash]
> > But the bonus here is that we didn't need to define a new hash
> > type, nor do any tricks with the commit->index field.
> 
> It took me a while to notice what's tricky, or rather inconsistent,
> about the khash set of commit objects with commit index as hash: We
> could just as well go all in and use an uint32_t khash set of commit
> indexes.  That would reduce the memory footprint further.  No pointers
> needed here.  Didn't measure a meaningful performance difference
> though, so that's that..

Heh, yes, that's true. I didn't even think about that. Conceptually we could replace "struct object" with just an index value, and then all code could just allocate arrays and index them. And the commit-slab code is essentially a slightly more dynamic version of that. And a hash of ints is a good way of handling a sparsely populated set of data.

It's less crazy than it sounds because we allocate objects sequentially and never free them anyway. But it would still be a pretty big change (and each data access would involve a few extra instructions to compute the address).

Anyway, I'm happy enough with the oidset solution you landed on.
-Peff
Previous: René ScharfeNext: René Scharfe
Message 19 of 21 in “describe: use khash in finish_depth_computation()”
  1. describe: use khash in finish_depth_computation()René Scharfe, Aug 24, 2025
  2. Jeff KingAug 24, 2025
  3. René ScharfeAug 24, 2025
  4. Jeff KingAug 25, 2025
  5. Jeff KingAug 25, 2025
  6. Junio C HamanoAug 25, 2025
  7. Jeff KingAug 26, 2025
  8. Jeff KingAug 26, 2025
  9. Jeff KingAug 26, 2025
  10. Junio C HamanoAug 26, 2025
  11. René ScharfeAug 31, 2025
  12. René ScharfeSep 1, 2025
  13. Jeff KingSep 2, 2025
  14. René ScharfeSep 2, 2025
  15. Jeff KingSep 3, 2025
  16. René ScharfeSep 3, 2025
  17. Jeff KingSep 4, 2025
  18. René ScharfeSep 3, 2025
  19. Jeff KingSep 4, 2025
  20. describe: use oidset in finish_depth_computation()René Scharfe, Sep 2, 2025
  21. Jeff KingSep 3, 2025

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.