Skip to content

Commit e828adc

Browse files
committed
[benchmark] Naming: emphasize ABBR are last resort
1 parent bc0064d commit e828adc

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

benchmark/Naming.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,22 @@ benchmark is testing individual method on a concrete type.
3333
````
3434

3535
Benchmark names are used to run individual tests when passed as command line
36-
arguments to the benchmark driver. Special characters that could be interpreted
37-
by the shell would require quoting. Stick to ASCII letters, numbers and period.
36+
arguments to the benchmark driver. Stick to ASCII letters, numbers and period.
3837
Exceptionally:
3938

4039
* Use **`-`** only to denote control flow constructs like `for-in` or `if-let`.
41-
* Use **`!`** and **`?`** for optional types, conditional or forced downcasting
42-
and optional chaining.
40+
* Use **`!`** and **`?`** for optional types, conditional or forced downcasting,
41+
optional chaining etc.
4342

4443
````
45-
✅ OCB.NSArray.AnyObject.as?.Array.NSString
46-
✅ OCB.NSArray.AnyObject.as!.Array.String
4744
✅ Array.append.Array.Int?
4845
✅ Flatten.Array.Tuple4.for-in.reserved
46+
✅ OCB.NSArray.as!.Array.NSString
4947
````
48+
49+
Note: Special characters that could be interpreted by the shell require escaping
50+
(`\!`) or quoting the name, when running such benchmarks individually.
51+
5052
</details><p><!-- spacer --></p></li>
5153
<li>
5254
<strong>Use groups and variants</strong> to structure the benchmark family by
@@ -56,7 +58,10 @@ differently sized variants.
5658
<details>
5759

5860
Benchmarks in a family can be grouped by the tested operation, method or varied
59-
by types and different workload sizes. It might be necessary to abbreviate some names to fit the size limit, based on the longest combination. Choose consistent names for the components throughout all members in the family, to allow for relative comparison across the different axis of variation.
61+
by types and different workload sizes. It might be necessary to abbreviate some
62+
names to fit the size limit, based on the longest combination. Choose consistent
63+
names for the components throughout all members in the family, to allow for
64+
relative comparison across the different axis of variation.
6065

6166
````
6267
✅ Seq.dropFirst.Array
@@ -106,7 +111,7 @@ There's no need to be literal with type names. **Be descriptive**:
106111

107112
</details><p><!-- spacer --></p></li>
108113
<li>
109-
<strong>Keep it short.</strong> 40 characters at most. Abbreviate if necessary!
114+
<strong>Keep it short.</strong> 40 characters at most. Abbreviate if necessary.
110115
<details>
111116

112117
Benchmarking results are reported on GitHub and very long names are causing
@@ -117,7 +122,7 @@ unique and short, than overly descriptive.*
117122

118123
Prefer concise names for potential benchmark family extensions. Leave out the
119124
nested types from variants if they aren't strictly necessary for disambiguation.
120-
If there's potentially valuable future variant, like testing `ContinuousArray`,
125+
If there's potentially valuable future variant, like testing `ContiguousArray`,
121126
keep the `Array` now, allowing for addition of `ContArr` variants later.
122127

123128
Use **`Val`** and **`Ref`** as short descriptors for variants that compare value
@@ -129,12 +134,13 @@ language prefix/suffix when necessary (`ASCIIChar`). For benchmarks that measure
129134
[two letter codes](https://en.wikipedia.org/wiki/ISO_639-1) instead of spelling
130135
out the whole language names.
131136

132-
In a pinch, even C-style naming with two letter prefixes `OC` (for Objective-C)
133-
or abbreviations like `Str` and `Arr` are OK, if it helps to fit a system with
134-
descriptive names into 40 characters:
137+
*In a pinch*, it's OK to use short C-style naming prefixes like `OCB` (for
138+
Objective-C Bridging) or consistent abbreviations in the benchmark family like
139+
`Str` and `Arr`, but *only if* it helps to fit a system with descriptive
140+
names into 40 characters:
135141

136142
````
137-
CharCount.ContArr.Str.kr
143+
OCB.NSDict.as!.Dictionary.NSString.NSNum
138144
✅ Seq.prefixWhile.AnySeq.UnfoldSeq.lazy
139145
````
140146

0 commit comments

Comments
 (0)