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

wide t/perf output, was Re: [ANNOUNCE] Git v2.19.0-rc0

From
Jeff King <peff@peff.net>
Date
Aug 23, 2018, 16:31 UTC
Message-ID
<20180823163130.GC29579@sigill.intra.peff.net>
In-Reply-To
<xmqqa7pdkyn9.fsf@gitster-ct.c.googlers.com>
On Thu, Aug 23, 2018 at 06:20:26AM -0700, Junio C Hamano wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Here are numbers for p0001.2 run against linux.git on a few
> > versions. This is using -O2 with gcc 8.2.0.
> >
> >   Test     v2.18.0             v2.19.0-rc0               HEAD
> >   ------------------------------------------------------------------------------
> >   0001.2:  34.24(33.81+0.43)   34.83(34.42+0.40) +1.7%   33.90(33.47+0.42) -1.0%
> 
> I see what you did to the formatting here, which is a topic of
> another thread ;-).

Do you happen to have a link? I missed that one, and digging turned up nothing.

A while ago I wrote the patch below. I don't recall why I never sent it in (and it doesn't apply cleanly these days, though I'm sure it could be forward-ported).

-- >8 --
Date: Wed, 20 Jan 2016 23:54:14 -0500
Subject: [PATCH] t/perf: add "tall" output format

When aggregating results, we usually show a list of tests, one per line, with the tested revisions in columns across. Like:

    $ ./aggregate.perl 348d4f2^ 348d4f2 p7000-filter-branch.sh
    Test                  348d4f2^               348d4f2
    -------------------------------------------------------------------
    7000.2: noop filter   295.32(269.61+14.36)   7.92(0.85+0.72) -97.3%

This is useful if you have a lot of tests to show, but few revisions; you're effectively comparing the two items on each line. But sometimes you have the opposite: few tests, but a large number of revisions. In this case, the lines get very long, and it's hard to compare values.

This patch introduces a "tall" format that shows the same data in a more vertical manner:

    $ ./aggregate.perl --tall \
        348d4f2^ 348d4f2 \
        jk/filter-branch-empty^ \
        jk/filter-branch-empty \
        p7000-filter-branch.sh
    Test: p7000-filter-branch.2
    348d4f2^                  295.32(269.61+14.36)
    348d4f2                        7.92(0.85+0.72) -97.3%
    jk/filter-branch-empty^        9.37(0.87+0.80) -96.8%
    jk/filter-branch-empty         7.71(0.92+0.62) -97.4%
Signed-off-by: Jeff King <peff@peff.net>
---
 t/perf/aggregate.perl | 124 ++++++++++++++++++++++++++++++------------
 1 file changed, 88 insertions(+), 36 deletions(-)
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index e401208488..d108a02ccd 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -17,29 +17,41 @@ sub get_times {
 	return ($rt, $4, $5);
 }
 
-sub format_times {
+sub format_times_list {
 	my ($r, $u, $s, $firstr) = @_;
 	if (!defined $r) {
 		return "<missing>";
 	}
 	my $out = sprintf "%.2f(%.2f+%.2f)", $r, $u, $s;
+	my $pct;
 	if (defined $firstr) {
 		if ($firstr > 0) {
-			$out .= sprintf " %+.1f%%", 100.0*($r-$firstr)/$firstr;
+			$pct = sprintf "%+.1f%%", 100.0*($r-$firstr)/$firstr;
 		} elsif ($r == 0) {
-			$out .= " =";
+			$pct = "=";
 		} else {
-			$out .= " +inf";
+			$pct = "+inf";
 		}
 	}
-	return $out;
+	return ($out, $pct);
+}
+
+sub format_times {
+	my ($times, $pct) = format_times_list(@_);
+	return defined $pct ? "$times $pct" : $times;
 }
 
 my (@dirs, %dirnames, %dirabbrevs, %prefixes, @tests);
+my ($tall_format);
 while (scalar @ARGV) {
 	my $arg = $ARGV[0];
 	my $dir;
 	last if -f $arg or $arg eq "--";
+	if ($arg eq "--tall") {
+		$tall_format = 1;
+		shift @ARGV;
+		next;
+	}
 	if (! -d $arg) {
 		my $rev = Git::command_oneline(qw(rev-parse --verify), $arg);
 		$dir = "build/".$rev;
@@ -122,6 +134,11 @@ sub have_slash {
 	return 0;
 }
 
+sub printable_dir {
+	my ($d) = @_;
+	return exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d};
+}
+
 my %newdirabbrevs = %dirabbrevs;
 while (!have_duplicate(values %newdirabbrevs)) {
 	%dirabbrevs = %newdirabbrevs;
@@ -132,44 +149,79 @@ sub have_slash {
 	}
 }
 
-my %times;
-my @colwidth = ((0)x@dirs);
-for my $i (0..$#dirs) {
-	my $d = $dirs[$i];
-	my $w = length (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
-	$colwidth[$i] = $w if $w > $colwidth[$i];
-}
-for my $t (@subtests) {
-	my $firstr;
+binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+
+if (!$tall_format) {
+	my %times;
+	my @colwidth = ((0)x@dirs);
 	for my $i (0..$#dirs) {
 		my $d = $dirs[$i];
-		$times{$prefixes{$d}.$t} = [get_times("$resultsdir/$prefixes{$d}$t.times")];
-		my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
-		my $w = length format_times($r,$u,$s,$firstr);
+		my $w = length(printable_dir($d));
 		$colwidth[$i] = $w if $w > $colwidth[$i];
-		$firstr = $r unless defined $firstr;
 	}
-}
-my $totalwidth = 3*@dirs+$descrlen;
-$totalwidth += $_ for (@colwidth);
-
-binmode STDOUT, ":utf8" or die "PANIC on binmode: $!";
+	for my $t (@subtests) {
+		my $firstr;
+		for my $i (0..$#dirs) {
+			my $d = $dirs[$i];
+			$times{$prefixes{$d}.$t} = [get_times("$resultsdir/$prefixes{$d}$t.times")];
+			my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
+			my $w = length format_times($r,$u,$s,$firstr);
+			$colwidth[$i] = $w if $w > $colwidth[$i];
+			$firstr = $r unless defined $firstr;
+		}
+	}
+	my $totalwidth = 3*@dirs+$descrlen;
+	$totalwidth += $_ for (@colwidth);
 
-printf "%-${descrlen}s", "Test";
-for my $i (0..$#dirs) {
-	my $d = $dirs[$i];
-	printf "   %-$colwidth[$i]s", (exists $dirabbrevs{$d} ? $dirabbrevs{$d} : $dirnames{$d});
-}
-print "\n";
-print "-"x$totalwidth, "\n";
-for my $t (@subtests) {
-	printf "%-${descrlen}s", $descrs{$t};
-	my $firstr;
+	printf "%-${descrlen}s", "Test";
 	for my $i (0..$#dirs) {
 		my $d = $dirs[$i];
-		my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
-		printf "   %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
-		$firstr = $r unless defined $firstr;
+		printf "   %-$colwidth[$i]s", printable_dir($d);
 	}
 	print "\n";
+	print "-"x$totalwidth, "\n";
+	for my $t (@subtests) {
+		printf "%-${descrlen}s", $descrs{$t};
+		my $firstr;
+		for my $i (0..$#dirs) {
+			my $d = $dirs[$i];
+			my ($r,$u,$s) = @{$times{$prefixes{$d}.$t}};
+			printf "   %-$colwidth[$i]s", format_times($r,$u,$s,$firstr);
+			$firstr = $r unless defined $firstr;
+		}
+		print "\n";
+	}
+} else {
+	my $shown = 0;
+	for my $t (@subtests) {
+		print "\n" if $shown++;
+		print "Test: $t\n";
+
+		my %times;
+		my $firstr;
+		for my $d (@dirs) {
+			my ($r, $u, $s) = get_times("test-results/$prefixes{$d}$t.times");
+			$times{$d} = [format_times_list($r, $u, $s, $firstr)];
+			$firstr = $r unless defined $firstr;
+		}
+
+		my $maxdirlen = 0;
+		my $maxtimelen = 0;
+		for my $d (@dirs) {
+			if (length($d) > $maxdirlen) {
+				$maxdirlen = length(printable_dir($d));
+			}
+			if (length($times{$d}->[0]) > $maxtimelen) {
+				$maxtimelen = length($times{$d}->[0]);
+			}
+		}
+		$maxdirlen++;
+
+		for my $d (@dirs) {
+			printf "%-${maxdirlen}s", printable_dir($d);
+			printf "   %${maxtimelen}s", $times{$d}->[0];
+			print " $times{$d}->[1]" if defined $times{$d}->[1];
+			print "\n";
+		}
+	}
 }
-- 
2.19.0.rc0.412.g7005db4e88
Previous: Junio C HamanoNext: brian m. carlson
Message 37 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.