path: root/t/perf/README
diff options
authorJeff King <>2018-08-17 20:56:37 (GMT)
committerJunio C Hamano <>2018-08-20 21:04:47 (GMT)
commit22bec79d1aef8fd82c7870e62f77b7817f0575a7 (patch)
tree94931434d3aa851e4ee00084d4e5e37ad4359836 /t/perf/README
parent5a924a62bb0fc5524101aeec9086aee530c2244d (diff)
t/perf: add infrastructure for measuring sizes
The main objective of scripts in the perf framework is to run "test_perf", which measures the time it takes to run some operation. However, it can also be interesting to see the change in the output size of certain operations. This patch introduces test_size, which records a single numeric output from the test and shows it in the aggregated output (with pretty printing and relative size comparison). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/perf/README')
1 files changed, 25 insertions, 0 deletions
diff --git a/t/perf/README b/t/perf/README
index 21321a0..be12090 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -168,3 +168,28 @@ that
While we have tried to make sure that it can cope with embedded
whitespace and other special characters, it will not work with
multi-line data.
+Rather than tracking the performance by run-time as `test_perf` does, you
+may also track output size by using `test_size`. The stdout of the
+function should be a single numeric value, which will be captured and
+shown in the aggregated output. For example:
+ test_perf 'time foo' '
+ ./foo >foo.out
+ '
+ test_size 'output size'
+ wc -c <foo.out
+ '
+might produce output like:
+ Test origin HEAD
+ -------------------------------------------------------------
+ 1234.1 time foo 0.37(0.79+0.02) 0.26(0.51+0.02) -29.7%
+ 1234.2 output size 4.3M 3.6M -14.7%
+The item being measured (and its units) is up to the test; the context
+and the test title should make it clear to the user whether bigger or
+smaller numbers are better. Unlike test_perf, the test code will only be
+run once, since output sizes tend to be more deterministic than timings.