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

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

From
René Scharfe <l.s.r@web.de>
Date
Jun 24, 2017, 12:12 UTC
Message-ID
<2cd8a407-f9a2-687a-3c78-6b502da2ad94@web.de>
In-Reply-To
<20170622231041.2zdjypviwmndjnsb@sigill.intra.peff.net>
Am 23.06.2017 um 01:10 schrieb Jeff King:
Show 8 quoted lines
> On Thu, Jun 22, 2017 at 08:19:48PM +0200, René Scharfe wrote:
> 
>> Read each loose object subdirectory at most once when looking for unique
>> abbreviated hashes.  This speeds up commands like "git log --pretty=%h"
>> considerably, which previously caused one readdir(3) call for each
>> candidate, even for subdirectories that were visited before.
> 
> Is it worth adding a perf test that's heavy on abbreviations?
Sure.  Here's a simple one.  It currently reports for me:

Test origin/master origin/next origin/pu --------------------------------------------------------------------------------------------- 4205.1: log with %H 0.44(0.41+0.02) 0.43(0.42+0.01) -2.3% 0.43(0.43+0.00) -2.3% 4205.2: log with %h 1.03(0.60+0.42) 1.04(0.64+0.39) +1.0% 0.57(0.55+0.01) -44.7% 4205.3: log with %T 0.43(0.42+0.00) 0.43(0.42+0.01) +0.0% 0.43(0.40+0.02) +0.0% 4205.4: log with %t 1.05(0.64+0.38) 1.05(0.61+0.42) +0.0% 0.59(0.58+0.00) -43.8% 4205.5: log with %P 0.45(0.42+0.02) 0.43(0.42+0.00) -4.4% 0.43(0.42+0.01) -4.4% 4205.6: log with %p 1.21(0.63+0.57) 1.17(0.68+0.47) -3.3% 0.59(0.58+0.00) -51.2% 4205.7: log with %h-%h-%h 1.05(0.64+0.39) 2.00(0.83+1.15) +90.5% 0.69(0.66+0.02) -34.3%

origin/next has fe9e2aefd4 (pretty: recalculate duplicate short hashes), while origin/pu has cc817ca3ef (sha1_name: cache readdir(3) results in find_short_object_filename()).

-- >8 --
Subject: [PATCH] p4205: add perf test script for pretty log formats
Add simple performance tests for expanded log format placeholders.
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 t/perf/p4205-log-pretty-formats.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100755 t/perf/p4205-log-pretty-formats.sh
diff --git a/t/perf/p4205-log-pretty-formats.sh b/t/perf/p4205-log-pretty-formats.sh
new file mode 100755
index 0000000000..7c26f4f337
--- /dev/null
+++ b/t/perf/p4205-log-pretty-formats.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+test_description='Tests the performance of various pretty format placeholders'
+
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+for format in %H %h %T %t %P %p %h-%h-%h
+do
+	test_perf "log with $format" "
+		git log --format=\"$format\" >/dev/null
+	"
+done
+
+test_done
-- 
2.13.1
Previous: Jeff KingNext: Jeff King
Message 22 of 30 in “[BUG] add_again() off-by-one error in custom format”
  1. Michael GiuffridaJun 12, 2017
  2. Junio C HamanoJun 12, 2017
  3. René ScharfeJun 13, 2017
  4. Junio C HamanoJun 13, 2017
  5. René ScharfeJun 13, 2017
  6. Junio C HamanoJun 13, 2017
  7. René ScharfeJun 14, 2017
  8. Jeff KingJun 15, 2017
  9. René ScharfeJun 15, 2017
  10. Jeff KingJun 15, 2017
  11. René ScharfeJun 18, 2017
  12. Jeff KingJun 18, 2017
  13. René ScharfeJun 18, 2017
  14. Jeff KingJun 18, 2017
  15. René ScharfeJun 22, 2017
  16. Jeff KingJun 22, 2017
  17. René ScharfeJun 18, 2017
  18. Jeff KingJun 18, 2017
  19. Junio C HamanoJun 19, 2017
  20. sha1_name: cache readdir(3) results in find_short_object_filename()René Scharfe, Jun 22, 2017
  21. Jeff KingJun 22, 2017
  22. René ScharfeJun 24, 2017
  23. Jeff KingJun 24, 2017
  24. René ScharfeJun 24, 2017
  25. Jeff KingJun 24, 2017
  26. René ScharfeJun 24, 2017
  27. Jeff KingJun 24, 2017
  28. Junio C HamanoJun 15, 2017
  29. SZEDER GáborJun 13, 2017
  30. René ScharfeJun 14, 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.