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

Re: [RFC PATCH 0/5] oidmap: handle entries with the same key

From
Jeff King <peff@peff.net>
Date
Jul 12, 2019, 21:58 UTC
Message-ID
<20190712215815.GB3593@sigill.intra.peff.net>
In-Reply-To
<xmqqlfx3p0zo.fsf@gitster-ct.c.googlers.com>
On Fri, Jul 12, 2019 at 11:21:47AM -0700, Junio C Hamano wrote:
Show 17 quoted lines
> > Christian Couder <christian.couder@gmail.com> writes:
> >
> >> This is an RFC patch series that is not intended to be merged for now,
> >> as it looks like we don't need oidmaps that can handle several entries
> >> with the same key yet.
> >
> > What does it even mean for a map to allow multiple entries per key?
> 
> Ah, one thing that I was missing (perhaps it was obvious to
> everybody else but me X-<) was that this is merely to expose what is
> already available in the underlying hashmap API, so let's not bother
> with the "don't people usually do a single key to a value, which
> happens to be a bag of stuff (not just a single stuff)?" question.
> 
> And from that "a generic hashmap can do this, and an upcoming code
> needs to use a hashmap keyed with oid in the same fashion" point of
> view, the new wrappers the patches add all made sense to me.
FWIW, I went through the same thought process. :)

One devil's advocate point against, though: we found recently that khash performs much better than hashmap.[ch] for the oidset data structure. AFAIK nobody has looked at whether the same is true for oidmap. But if it is, then this strategy may make it harder to switch.

(OTOH, we already have kh_oid_map, so the two could probably co-exist and we could just convert particular callers from one to the other).

Show 5 quoted lines
> > I actually think that showing how it is used in the real application
> > (reftable?) is the best way to illustrate why this is useful and to
> > get opinions from others.
> 
> This part still stands, though.
Agreed.
-Peff
Previous: Junio C Hamano
Message 9 of 9 in “oidmap: handle entries with the same key”
  1. 0/5 oidmap: handle entries with the same keyChristian Couder, Jul 7, 2019
  2. 1/5 oidmap: add oidmap_add()Christian Couder, Jul 7, 2019
  3. 2/5 oidmap: add oidmap_get_next()Christian Couder, Jul 7, 2019
  4. 3/5 test-oidmap: add back proper 'add' subcommandChristian Couder, Jul 7, 2019
  5. 4/5 test-oidmap: add 'get_all' subcommandChristian Couder, Jul 7, 2019
  6. 5/5 t0016: add 'add' and 'get_all' subcommand testChristian Couder, Jul 7, 2019
  7. Junio C HamanoJul 8, 2019
  8. Junio C HamanoJul 12, 2019
  9. Jeff KingJul 12, 2019

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.