Maybe it would help to show people a table of all the benchmark data, ordered by some arbitrary data point like runtime, so they can compare the old and new names in a real setting and see how much easier it is to pick out a data point. In fact, I'd like to see that to better evaluate your PR myself.
Let me re-emphasize that for now I have proposed the naming convention (NC) to be applied to newly added benchmarks only. But to demonstrate the NC in action, especially to highlight how it solves existing issues, it makes perfect sense to try a hypothetical rename of existing benchmarks.
I've kept the idea of renaming existing tests in the back of my head, though. It would be possible to do the same trick as with legacyFactor and introduce a legacyName to aid in reorganizing SBS according to proposed NC and simply double report results from Benchmark_O and Benchmark_Driver to maintain the continuity of long-term performance tracking with lnt. It would make great sense to report 2 times: legacy with old names and factor applied and new names without legacyFactor — i.e. slowly transition to cleaned up SBS over upcoming Swift releases and finally retire the legacy in Swift 6. But that isn't part of the proposed NC and shouldn't be judged as such!
Looking at all benchmark names, the length becomes a problem only for large benchmark families. Currently there are overall 722 individual benchmarks, 555 are executed pre-commit (not marked .skip or .unstable). Biggest length offenders are in the large disabled benchmark families, which can be safely renamed and re-enabled after clean-up:
Existential (100 benchmarks) — See PR #20666 for a rename of these and addition of 8 more.
StringWalk, CharIndexing and CharIteration (72 benchmarks) — These are on my TODO list, I'll update here as soon as there's a PR applying the proposed NC.
Then there are 10 benchmarks from ObjectiveCBridging family longer than 40 characters, this has been extensively discussed in the PR. Final hypothetical rename would look like this:
Bridging (18 benchmarks)
| After |
Before |
| Bridging.NSString.as?.String |
ObjectiveCBridgeFromNSString |
| Bridging.NSString.as!.String |
ObjectiveCBridgeFromNSStringForced |
| Bridging.String.as.NSString |
ObjectiveCBridgeToNSString |
| Bridging.NSArray.as?.Array.NSString |
ObjectiveCBridgeFromNSArrayAnyObject |
| Bridging.NSArray.as!.Array.NSString |
ObjectiveCBridgeFromNSArrayAnyObjectForced |
| Bridging.Array.String.as.NSArray |
ObjectiveCBridgeToNSArray |
| Bridging.NSArray.as?.Array.String |
ObjectiveCBridgeFromNSArrayAnyObjectToString |
| Bridging.NSArray.as!.Array.String |
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced |
| Bridging.NSDict.as?.Dict.NSString.NSNum |
ObjectiveCBridgeFromNSDictAnyObject |
| Bridging.NSDict.as!.Dict.NSString.NSNum |
ObjectiveCBridgeFromNSDictAnyObjectForced |
| Bridging.Dict.String.Int.as.NSDict |
ObjectiveCBridgeToNSDict |
| Bridging.NSDict.as?.Dict.String.Int |
ObjectiveCBridgeFromNSDictAnyObjectToString |
| Bridging.NSDict.as!.Dict.String.Int |
ObjectiveCBridgeFromNSDictAnyObjectToStringForced |
| Bridging.NSSet.as?.Set.NSString |
ObjectiveCBridgeFromNSSetAnyObject |
| Bridging.NSSet.as!.Set.NSString |
ObjectiveCBridgeFromNSSetAnyObjectForced |
| Bridging.Set.String.as.NSSet |
ObjectiveCBridgeToNSSet |
| Bridging.NSSet.as?.Set.String |
ObjectiveCBridgeFromNSSetAnyObjectToString |
| Bridging.NSSet.as!.Set.String |
ObjectiveCBridgeFromNSSetAnyObjectToStringForced |
Outside of these, there are 11 more benchmarks that are over 40 characters long. The NC PR updates the validation with BenchmarkDoctor to issues the check report with following diagnostics:
 |
Benchmark Check Report |
  |
DictionarySubscriptDefaultMutationArrayOfObjects name is 48 characters long. Benchmark name should not be longer than 40 characters. |
  |
DictionarySubscriptDefaultMutationOfObjects name is 43 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Double_description_small name is 46 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Double_description_uniform name is 48 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Double_interpolated name is 41 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Float80_description_small name is 47 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Float80_description_uniform name is 49 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Float80_interpolated name is 42 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Float_description_small name is 45 characters long. Benchmark name should not be longer than 40 characters. |
  |
FloatingPointPrinting_Float_description_uniform name is 47 characters long. Benchmark name should not be longer than 40 characters. |
  |
NormalizedIterator_nonBMPSlowestPrenormal name is 41 characters long. Benchmark name should not be longer than 40 characters. |
| Benchmark Family |
benchmarks |
longer than 40 |
introduced |
FloatingPointPrinting |
9 |
9 |
9 months ago |
NormalizedIterator |
8 |
1 |
2 months ago |
It's quite obvious these are all also part of larger families, and they are longer than 40 characters simply because there was no forcing function. That is the point of proposed NC combined with the check of newly added benchmarks, which also includes these messages hinting at the solution:
 |
Benchmark Check Report |
  |
DictionarySubscriptDefaultMutationOfObjects name is composed of 6 words. Split DictionarySubscriptDefaultMutationOfObjects name into dot-separated groups and variants. See http://bit.ly/BenchmarkNaming |
  |
FloatingPointPrinting_Double_description_uniform name doesn`t conform to benchmark naming convention. See http://bit.ly/BenchmarkNaming |
The second message, the naming error, is issued because of the presence of the underscore, which clearly plays the separator role suggested in the previous warning. The proposed NC is here clearly just unifying an emergent practice in SBS naming: The FloatingPointPrinting family had 2 degrees of freedom: type (Double, Float, Float80) tested method (description, interpolated string) with one extra variant for range (small vs. uniform).
Given the FloatingPoint prefix is semantically redundant, because the actual types are part of the benchmark names anyway, the renaming would be rather trivial, with longest name coming at 36 characters long:
Printing.Float.description.Small
Printing.Float80.description.Uniform
Printing.Double.IterpolatedString
Here's another example — correcting myself — as in the hindsight, my first crack at this issue while adding sequence slicing benchmarks, wasn't completely successful. I have only focused on the length limit and the readability clearly suffered.
 |
Benchmark Check Report |
  |
DropFirstAnySeqCRangeIterLazy name is composed of 7 words. Split DropFirstAnySeqCRangeIterLazy name into dot-separated groups and variants. See http://bit.ly/BenchmarkNaming |
I've incorporated the lessons learned into the new proposal. Rename example straight from NC proposal:
Seq.dropFirst.Array
Seq.dropLast.Range.lazy
Seq.dropWhile.UnfoldSeq
Seq.prefix.AnySeq.RangeIter.lazy
Seq.prefixWhile.AnyCol.Array
Seq.suffix.AnySeq.UnfoldSeq.lazy
No automated solution can replace the insight of the author in designing a coherent naming system in these cases. Here are 4 benchmarks added 10 days ago, Codable.swift: JSONPerfDecode, JSONPerfEncode, PlistPerfDecode, PlistPerfEncode. With the NC in place, these should have been named like:
Codable.encode.JSON
Codable.decode.PropertyList
But this thread wasn't supposed to be about debating the naming convention and I find this diversion quite frustrating. So let me be a bit more blunt:
- Swift performance is fragile (i.e. it SUCKS!!!!) What are we going to do about this?! My suggestion:
- Systematically increase coverage (step
from above), which requires NC to manage the increase in number of benchmarks.
Instead the NC PR is stuck on red herrings of clarity (aversion to abbreviations) and flexibility (aversion to length limit). So let me ask again, HOW are we going to un-suck Swift's fragile performance problem? Because what I'm hearing so far is:
:format(webp)/cdn.vox-cdn.com/uploads/chorus_image/image/50310263/658.0.0.png)