Am 23.06.2017 um 01:10 schrieb Jeff King: > 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@xxxxxxxx> Signed-off-by: Rene Scharfe <l.s.r@xxxxxx> --- 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