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

Re: [PATCH 2/5] hashmap: allow memihash computation to be continued

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2017, 20:27 UTC
Message-ID
<xmqqwpckip5c.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<alpine.DEB.2.20.1702201342020.3496@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
>> If an extra call level really matters, its "inline" equivalent in
>> the header would probably be good.
>
> Well, the hashing is supposed to be as fast as possible, so I would like
> to avoid that extra call level. However, the end result is not so pretty
> because FNV32_BASE needs to be made public (OTOH it removes more lines
> than it adds):

I think our usual answer is "can we measure the difference to demonstrate that the overhead for an extra call matter?"

As two functions sit next to each other in a single file, the code duplication does not bother me _that_ much. A single liner

    /* keep implementations of these two in sync */

in front of these two functions would not hurt, but whoever attempts to come up with a better hash needs to stare at this file carefully anyway, so lack of such carefulness probably wouldn't be too big an issue, either.

But the above 8 lines are something we need to worry about after we definitely know that we MUST have two independent functions that are supposed to be kept in sync; a patch that makes us worry them before we know is a premature optimization, and that bothers me even more than the actual code duplication that can drift apart.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 11 of 25 in “A series of performance enhancements in the memihash and name-cache area”
  1. 0/5 A series of performance enhancements in the memihash and name-cache areaJohannes Schindelin, Feb 14, 2017
  2. 5/5 name-hash: remember previous dir_entry during lazy_init_name_hashJohannes Schindelin, Feb 14, 2017
  3. 3/5 name-hash: precompute hash values during preload-indexJohannes Schindelin, Feb 14, 2017
  4. Junio C HamanoFeb 18, 2017
  5. Jeff HostetlerFeb 19, 2017
  6. Junio C HamanoFeb 19, 2017
  7. 1/5 name-hash: eliminate duplicate memihash callJohannes Schindelin, Feb 14, 2017
  8. 2/5 hashmap: allow memihash computation to be continuedJohannes Schindelin, Feb 14, 2017
  9. Junio C HamanoFeb 18, 2017
  10. Johannes SchindelinFeb 20, 2017
  11. Junio C HamanoFeb 20, 2017
  12. 4/5 name-hash: specify initial size for istate.dir_hash tableJohannes Schindelin, Feb 14, 2017
  13. Jeff KingFeb 14, 2017
  14. Jeff HostetlerFeb 15, 2017
  15. Jeff KingFeb 15, 2017
  16. Junio C HamanoFeb 18, 2017
  17. Jeff HostetlerFeb 19, 2017
  18. Junio C HamanoFeb 18, 2017
  19. Jeff KingFeb 18, 2017
  20. Junio C HamanoFeb 18, 2017
  21. Jeff HostetlerFeb 18, 2017
  22. Junio C HamanoFeb 19, 2017
  23. Junio C HamanoMar 2, 2017
  24. Jeff HostetlerMar 2, 2017
  25. Junio C HamanoMar 2, 2017

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.