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

Re: [PATCH v2] use a hashmap to make remotes faster

From
Jeff King <peff@peff.net>
Date
Sep 5, 2014, 15:16 UTC
Message-ID
<20140905151626.GA1846@peff.net>
In-Reply-To
<5409887A.1000602@gmail.com>
On Fri, Sep 05, 2014 at 11:55:06AM +0200, Stefan Beller wrote:
Show 10 quoted lines
> >  struct remote {
> > +	struct hashmap_entry ent;  /* must be first */
> > +
> 
> I stumbled about this comment  "/* must be first */"
> when reading the changelog.
> 
> Why does it need to be first?
> Is it a common reason I'm just not aware of,
> or would it make sense to put the reason into the comment as well?

Yes, it's a requirement of the hashmap code. It stores arbitrary structs, but uses the front of the type for its bookkeeping data (the hash and a linked list pointer to the next item in the bucket). This is documented in Documentation/technical/api-hashmap.txt.

-Peff
Previous: Stefan Beller
Message 5 of 5 in “use a hashmap to make remotes faster”
  1. use a hashmap to make remotes fasterPatrick Reynolds, Jul 29, 2014
  2. Jeff KingJul 29, 2014
  3. Junio C HamanoJul 30, 2014
  4. Stefan BellerSep 5, 2014
  5. Jeff KingSep 5, 2014

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.