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

Re: [ANNOUNCE] Git v2.19.0-rc0

From
Jeff King <peff@peff.net>
Date
Aug 21, 2018, 21:29 UTC
Message-ID
<20180821212923.GB24431@sigill.intra.peff.net>
In-Reply-To
<1b20b754-987c-a712-2594-235b845bc5d0@gmail.com>
On Tue, Aug 21, 2018 at 04:41:02PM -0400, Derrick Stolee wrote:
Show 7 quoted lines
> On 8/20/2018 6:13 PM, Junio C Hamano wrote:
> > An early preview release Git v2.19.0-rc0 is now available for
> > testing at the usual places.
> 
> As part of testing the release candidate, I ran the performance suite
> against a fresh clone of the Linux repository using v2.18.0 and v2.19.0-rc0
> (also: GIT_PERF_REPEAT_COUNT=10).
Wow, you're a glutton for punishment. :)
Show 12 quoted lines
> I found a few nice improvements, but I
> also found a possible regression in tree walking. I say "tree walking"
> because it was revealed using p0001-rev-list.sh, but only with the
> "--objects" flag. I also saw some similar numbers on 'git log --raw'.
> 
> Test v2.18.0             v2.19.0-rc0
> --------------------------------------------------------------------------------------------
> 0001.1: rev-list --all 6.69(6.33+0.35)     6.52(6.20+0.31) -2.5%
> 0001.2: rev-list --all --objects 52.14(47.43+1.02)   57.15(51.09+1.18) +9.6%
> 
> To me, 9.6% seems out of the range of just noise for this length of a
> command, but I could be wrong. Could anyone else try to repro these results?
I got:
0001.2: rev-list --all --objects  37.07(36.62+0.45)   39.11(38.58+0.51) +5.5%

Less change, but my overall times were smaller, too, so clearly our hardware or exact repos are a little bit different. Those numbers seem pretty consistent in further runs.

It bisects to 509f6f62a4 (cache: update object ID functions for the_hash_algo, 2018-07-16). Which make sense. An "--objects" traversal spends a huge amount of time checking each tree entry to see if we've processed that object yet, which ends up as hashcmp() in the hash table. I expect that a fixed 20-byte memcmp() can be optimized a lot more than one with an arbitrary value.

Even if _we_ know the value can only take on one of a few values, I don't know that we have an easy way to tell the compiler that. Possibly we could improve things by jumping directly to an optimized code path. Sort of a poor-man's JIT. ;)

Doing this:
diff --git a/cache.h b/cache.h
index b1fd3d58ab..9c004a26c9 100644
--- a/cache.h
+++ b/cache.h
@@ -1023,7 +1023,10 @@ extern const struct object_id null_oid;
 
 static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2)
 {
-	return memcmp(sha1, sha2, the_hash_algo->rawsz);
+	if (the_hash_algo->rawsz == 20)
+		return memcmp(sha1, sha2, 20);
+	else
+		return memcmp(sha1, sha1, the_hash_algo->rawsz);
 }
 
 static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2)
on top of v2.19-rc0 seems to give me about a 3% speedup (though I might
be imaging it, as there's a bit of noise). A function pointer in
the_hash_algo might make even more sense.

-Peff
Previous: Derrick StoleeNext: brian m. carlson
Message 7 of 58 in “[ANNOUNCE] Git v2.19.0-rc0”
  1. Junio C HamanoAug 20, 2018
  2. Stefan BellerAug 20, 2018
  3. Jonathan NiederAug 20, 2018
  4. Jonathan NiederAug 21, 2018
  5. Stefan BellerAug 21, 2018
  6. Derrick StoleeAug 21, 2018
  7. Jeff KingAug 21, 2018
  8. brian m. carlsonAug 22, 2018
  9. Jeff KingAug 22, 2018
  10. Jeff KingAug 22, 2018
  11. Derrick StoleeAug 22, 2018
  12. brian m. carlsonAug 22, 2018
  13. Jeff KingAug 22, 2018
  14. Ævar Arnfjörð BjarmasonAug 22, 2018
  15. Derrick StoleeAug 22, 2018
  16. Jeff KingAug 22, 2018
  17. Duy NguyenAug 22, 2018
  18. Duy NguyenAug 22, 2018
  19. Jeff KingAug 22, 2018
  20. Derrick StoleeAug 22, 2018
  21. Duy NguyenAug 22, 2018
  22. Derrick StoleeAug 22, 2018
  23. Jeff KingAug 22, 2018
  24. Junio C HamanoAug 22, 2018
  25. Jeff KingAug 22, 2018
  26. Derrick StoleeAug 22, 2018
  27. Jeff KingAug 22, 2018
  28. Paul SmithAug 22, 2018
  29. Jeff KingAug 22, 2018
  30. Jonathan NiederAug 23, 2018
  31. Jeff KingAug 23, 2018
  32. Jonathan NiederAug 23, 2018
  33. Jeff KingAug 23, 2018
  34. brian m. carlsonAug 23, 2018
  35. Jonathan NiederAug 23, 2018
  36. Junio C HamanoAug 23, 2018
  37. wide t/perf output, was Re: [ANNOUNCE] Git v2.19.0-rc0Jeff King, Aug 23, 2018
  38. brian m. carlsonAug 23, 2018
  39. Jeff KingAug 23, 2018
  40. Derrick StoleeAug 23, 2018
  41. Junio C HamanoAug 23, 2018
  42. Jeff KingAug 23, 2018
  43. Jacob KellerAug 23, 2018
  44. Jeff KingAug 23, 2018
  45. Jeff KingAug 24, 2018
  46. Jeff KingAug 24, 2018
  47. Jacob KellerAug 24, 2018
  48. Jeff KingAug 24, 2018
  49. Jeff KingAug 24, 2018
  50. Derrick StoleeAug 24, 2018
  51. Junio C HamanoAug 27, 2018
  52. Jeff KingAug 23, 2018
  53. Derrick StoleeAug 23, 2018
  54. Jeff KingAug 24, 2018
  55. Ævar Arnfjörð BjarmasonAug 24, 2018
  56. Derrick StoleeAug 24, 2018
  57. Jeff KingAug 25, 2018
  58. Kaartic SivaraamSep 2, 2018

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.