Skip to content

Commit eac21d3

Browse files
committed
design: tweaks to 14313
Clarify and fix various things based on comments from issue go/golang#14313. Change-Id: I53a7005b2b6c5c0e973373febfae5f8278d867bc Reviewed-on: https://go-review.googlesource.com/21030 Reviewed-by: Russ Cox <[email protected]>
1 parent 3c72fa4 commit eac21d3

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

design/14313-benchmark-format.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ the need to process custom output formats in future benchmarks.
8686

8787
## Proposal
8888

89-
A Go benchmark data file is a textual file consisting of a sequence of lines.
89+
A Go benchmark data file is a UTF-8 textual file consisting of a sequence of lines.
9090
Configuration lines and benchmark result lines, described below,
9191
have semantic meaning in the reporting of benchmark results.
9292

@@ -102,13 +102,15 @@ A configuration line is a key-value pair of the form
102102

103103
key: value
104104

105-
where key contains no space characters (as defined by `unicode.IsSpace`)
105+
where key begins with a lower case character (as defined by `unicode.IsLower`),
106+
contains no space characters (as defined by `unicode.IsSpace`)
106107
nor upper case characters (as defined by `unicode.IsUpper`),
107-
and space characters separate “key:” from “value.”
108+
and one or more ASCII space or tab characters separate “key:” from “value.”
108109
Conventionally, multiword keys are written with the words
109110
separated by hyphens, as in cpu-speed.
110111
There are no restrictions on value, except that it cannot contain a newline character.
111-
Value can be omitted entirely but the colon must still be present.
112+
Value can be omitted entirely, in which case the colon must still be
113+
present, but need not be followed by a space.
112114

113115
The interpretation of a key/value pair is up to tooling, but the key/value pair
114116
is considered to describe all benchmark results that follow,
@@ -125,7 +127,9 @@ so the line can be parsed with `strings.Fields`.
125127
The line must have an even number of fields, and at least four.
126128

127129
The first field is the benchmark name, which must begin with `Benchmark`
128-
and is typically followed by a capital letter, as in `BenchmarkReverseString`.
130+
followed by an upper case character (as defined by `unicode.IsUpper`)
131+
or the end of the field,
132+
as in `BenchmarkReverseString` or just `Benchmark`.
129133
Tools displaying benchmark data conventionally omit the `Benchmark` prefix.
130134
The same benchmark name can appear on multiple result lines,
131135
indicating that the benchmark was run multiple times.
@@ -287,7 +291,7 @@ anticipated future work on benchmark reporting.
287291

288292
The main known issue with the current `go test -bench` is that
289293
we'd like to emit finer-grained detail about runs, for linearity testing
290-
and more robust statistics.
294+
and more robust statistics (see [issue 10669](https://golang.org/issue/10669)).
291295
This proposal allows that by simply printing more result lines.
292296

293297
Another known issue is that we may want to add custom outputs

0 commit comments

Comments
 (0)