Commit Graph

905 Commits

Author SHA1 Message Date
Pavol Vaskovic
776ace0676 [benchmark] Disable ExistentialPerformance
Don’t run the ExistentialPerformance benchmarks as part of the pre-commit suite.
2019-02-12 21:17:31 +01:00
Andrew Trick
6d3397337d Fix performance of array initialization from a generic sequence.
This fixes a major perform bug involving array initialization from any
contiguously stored collection.	 This is not a recent regression. This fix
results in a 10,000X speedup (that's 4 zeros) for this code path:

func initializeFromSlice(_ a: [Int]) -> [Int] {
  return Array<Int>(a[...])
}

A benchmark is included.
2019-02-11 19:41:45 -08:00
Pavol Vaskovic
fa9b52e586 Merge pull request #22508 from palimondo/against-the-dark
[benchmark] Janitor Duty: Troublemaker Legacy
2019-02-11 20:40:09 +01:00
Pavol Vaskovic
80b95176af Merge pull request #22296 from palimondo/a-tall-white-fountain-played
[benchmark] Janitor Duty: Sisyphus Legacy
2019-02-11 20:39:20 +01:00
Pavol Vaskovic
c8d59b8536 [benchmark] ProtocolDispatch2 resized & re-enabled 2019-02-11 18:03:32 +01:00
Pavol Vaskovic
2f2096f5fd [benchmark] ProtocolDispatch resized & re-enabled 2019-02-11 18:03:31 +01:00
Pavol Vaskovic
9bfe20867e [benchmark] Fibonacci: fixed, resized & re-enabled 2019-02-11 18:03:31 +01:00
Pavol Vaskovic
f1fff00230 [benchmark] Radix2CooleyTukey(f) Legacy Factor 2019-02-11 18:03:30 +01:00
Pavol Vaskovic
267b1690ec [benchmark] ObjectiveCNoBridgingStubs legacyFactor 2019-02-11 18:03:30 +01:00
Pavol Vaskovic
37a788ade3 [benchmark] ObjectiveCBridging Legacy Factor 2019-02-11 18:03:30 +01:00
Pavol Vaskovic
ba25afb928 [benchmark] ObjectiveCBridgingStubs Legacy Factor 2019-02-11 18:03:30 +01:00
Pavol Vaskovic
d776ad5284 [benchmark] FloatingPointPrinting Legacy Factor 2019-02-11 18:03:29 +01:00
Pavol Vaskovic
b61a63d16a [benchmark] Add docs & adjust loop multipliers
Bumping up the multipliers to get above 20 μs runtime.
2019-02-07 15:14:32 +01:00
Pavol Vaskovic
0ac591e27b [benchmark] Add .existential BenchmarkCategory 2019-02-06 12:38:50 +01:00
Pavol Vaskovic
35163f19c7 [benchmark] Refactor: Despecialized Existential
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.
2019-02-06 12:38:49 +01:00
Pavol Vaskovic
5ad2698799 [benchmark] Refactor: type independent variants
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.
2019-02-06 12:38:49 +01:00
Pavol Vaskovic
6b29523f0c [benchmark] Gardening: 80 col Existential
Break up BenchmarkInfo into 2 lines to fit 80 column line limit.
2019-02-06 12:38:49 +01:00
Pavol Vaskovic
2702633386 [benchmark] Extract setup from Existential.Array
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.
2019-02-06 12:38:48 +01:00
Pavol Vaskovic
06cf0c898b [benchmark] Existential: shorter names
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.
2019-02-06 12:38:48 +01:00
Pavol Vaskovic
5bbb9ff509 [benchmark] Gardening: BenchmarkInfo order
Sanity refactoring:
* Generate `BenchmarkInfo` in the same order as run loops.
* Generate `IntValueBuffer0`, too.
* Minor code formatting tweeks.
2019-02-06 12:38:48 +01:00
Pavol Vaskovic
1bd702a24c [benchmark] GYB ExistentialPerformance
Painstakingly reverse-engineered the boilerplate generator, that produces ExistentialPerformance.swift (sans few whitespace differences), to ease maintanance (The upcoming refactoring).
2019-02-06 12:38:47 +01:00
Pavol Vaskovic
ae4ecbe8b6 [benchmark] Adjust Existential workload sizes
Reduced base workloads. This allows precise measurements without the noise of accumulated error from unnecessarily long runtimes.
2019-02-06 12:38:47 +01:00
Pavol Vaskovic
94d94ee2f5 [benchmark] Rehouse DistinctClassFieldAccesses
Benchmark DistinctClassFieldAccesses was added in a strange place…
See https://github.com/apple/swift/pull/18892/files#r212038958

Per discussion in in https://github.com/apple/swift/pull/18892#issuecomment-435695071
I’m moving it to the extremely similar `ArrayInClass`, while fixing its workload size (and loop pattern) to make it relatively comparable.
2019-02-06 12:38:47 +01:00
Pavol Vaskovic
5f92040224 [benchmark] Revert bigger name change
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...
2019-02-04 08:53:01 +01:00
Pavol Vaskovic
70a9adafbd Revert "Revert "[benchmark] RomanNumbers Redux"" 2019-02-04 08:45:06 +01:00
Ben Cohen
95a15d12bd Revert count(where:) (#22289) 2019-02-01 15:05:06 -08:00
Joe Shajrawi
adfce60b2e Revert "[benchmark] RomanNumbers Redux" 2019-02-01 11:20:19 -08:00
Pavol Vaskovic
d3dfbdbb86 Merge pull request #22227 from palimondo/a-tall-white-fountain-played
[benchmark] RomanNumbers Redux
2019-02-01 18:03:04 +01:00
Pavol Vaskovic
ff4e8de340 [benchmark] WordCount, WordSplit Legacy Factor 2019-02-01 16:47:57 +01:00
Pavol Vaskovic
1dcdacf51a [benchmark] TwoSum Legacy Factor 2019-02-01 16:47:02 +01:00
Pavol Vaskovic
18538b283a [benchmark] StackPromo Legacy Factor 2019-02-01 16:46:48 +01:00
Pavol Vaskovic
5e6fa19407 [benchmark] SortStrings Legacy Factor 2019-02-01 16:46:31 +01:00
Pavol Vaskovic
531ff3850e [benchmark] SortLargeExistentials Legacy Factor 2019-02-01 16:46:13 +01:00
Pavol Vaskovic
44b4f0de79 [benchmark] SortIntPyramids Legacy Factor 2019-02-01 16:45:50 +01:00
Pavol Vaskovic
25729f89fa [benchmark] SetTests Legacy Factor 4 Legacy Tests 2019-02-01 16:45:12 +01:00
Pavol Vaskovic
b6a069c96e [benchmark] SequenceAlgos Legacy Factor
Also inlined runFunctions and setUpFunctions.
2019-02-01 16:42:56 +01:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Pavol Vaskovic
e15aff31b7 [benchmark] DataCreateSmall - Fix legacyFactor
Adjust the multipliers for legacy factor and inner loop to account for the improved performance of the `Data` implementation.
2019-01-31 19:05:12 +01:00
Pavol Vaskovic
f104383529 [benchmark] RomanNumeral pared back down
Remove the extended benchmark coverage to leave only bug-fixed version of `RomanNumeral` benchmark with the new name `Roman.Substring.startsWith.dropFirst`.
2019-01-31 06:58:44 +01:00
Pavol Vaskovic
0edd560dc3 [benchmark] RomanNumbers Redux
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`.
2019-01-29 22:20:03 +01:00
David Smith
2e194e6d6a Add a benchmark for bridging date components 2019-01-24 15:45:26 -08:00
Pavol Vaskovic
6da0389cf7 Merge pull request #22026 from palimondo/a-tall-white-fountain-played
[benchmark] Janitor Duty: Thesaurus Heirloom
2019-01-23 19:43:43 +01:00
Pavol Vaskovic
3417ee6d98 [benchmark] RGBHistogram Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
8d00ce0efb [benchmark] FilterEvenUsingReduce Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
f477e6b675 [benchmark] RangeReplaceableCollectionPlusDef. LF 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
91f25f68b9 [benchmark] RandomValues Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
8cb61308e9 [benchmark] RandomShuffle Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
6a657bca5a [benchmark] Queue Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
1a72543d1f [benchmark] Prims Legacy Factor 2019-01-22 09:26:05 +01:00
Pavol Vaskovic
aecea3334e [benchmark] PopFront Legacy Factor 2019-01-22 09:26:05 +01:00