The technique from preceding commit, can be used to fully determine the tested type variant in the `setUpFunction` and use a non-generic `runFunction`s for all the benchmarks.
This eliminates 202 lines of boilerplate.
Benchmarks from Array group (except the `init`) don’t use the `withType` parameter from the `run_` function anymore. The type specific variation is taken care of in the `BenchmarkInfo`, since the `existentialArray` with appropriate type is created by the `setUpFunction`. This means we can reuse the same non-generic `run_ ` function for the whole group and eliminate all the specialized `runFunction` variants.
This eliminates 144 lines of boilerplate.
Existential.Array group had setup overhead caused by initialization of the existential array. Since this seems to be quite substatial and is dependant on the existential type, it makes sense to add Array.init benchmark group that will measure it explicitly.
Array setup is extracted into 9 type-specific functions. The setup inside the `run_` functions now grabs that array, prepared in `setUpFunction`, excluding the initialization from the measurement.
This helped with extracting setup overhead from most cases, but it appears that the mutable test still have measurable overhead because they perform COW. I’ve tried to work around this by transfering ownership of the pre-initialized array with the `grabArray` function, but nilling the IUO was crashing at runtime. This should be fixed later.
Renamed tests according to the naming convention proposed in PR #20334.
They now fit the 40 character limit and are structured into groups and variants.
Also extracted tags into 2 constants, to simplify the [BenchmarkInfo] expression.
Painstakingly reverse-engineered the boilerplate generator, that produces ExistentialPerformance.swift (sans few whitespace differences), to ease maintanance (The upcoming refactoring).
Remove the `get_results` function, which is no longer used after the refactoring that rebased the benchmark measurements on `BenchmarDriver` class in #21684.
To avoid the need to mess with `lit` tests due to renamed benchmark, let's just add the customary suffix `2` for the bugfixed version. We'll fight the renaming battle another day...
Remove the extended benchmark coverage to leave only bug-fixed version of `RomanNumeral` benchmark with the new name `Roman.Substring.startsWith.dropFirst`.
Rewrite of the `RomanNumbers` benchmark that fixes error in the `position` which was always reset to 0 after `continue outer`, by swapping the `while` and `for-in` loops into more natural order, which eliminates the need for using `position` at all. This is based on examples from [Rosetta Code](https://www.rosettacode.org/wiki/Roman_numerals/Decode#Swift).
The coverage has been expanded to measure performance of `String`/`Substring`/`UTF8View` with very short string arguments and methods: `hasPrefix`/`starts(with:)`, `removeFirst`/`dropFirst` and `String.append()`, as well as functional variants of the fastest imperative version.
The `Roman.Substring.startsWith.dropFirst` variant tests the same code paths as the original `RomanNumbers` benchmark, but the name is changed because of the bug-fix and lowered workload (to run in less than 1000 μs).
For comparison, there's one extra variant with character based parsing algorithm: `Roman.DictCharInt.map.reduce`.