Commit Graph

905 Commits

Author SHA1 Message Date
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
David Smith
f85e1fee22 Generalize the JSON perf tests to Codable 2018-12-03 11:16:47 -08:00
swift-ci
ece1bfc85a Merge pull request #20886 from Catfish-Man/someone-called-json-is-decoding-things 2018-11-29 22:14:17 -08:00
David Smith
c129066b39 Add simple benchmarks for JSON coding 2018-11-29 17:41:50 -08:00
Karoy Lorentey
41c9a222da [benchmark] DictTest4Legacy: Add dummy hash(into:)
The new definition is the same as the one synthesized by the compiler.
2018-11-29 17:52:50 +00:00
Karoy Lorentey
74eaea2a6a [benchmark] Add some benchmarks for String breadcrumbs (#20769)
[benchmark] Add some benchmarks for String breadcrumbs
2018-11-28 16:24:29 -08:00
swift-ci
f093925036 Merge pull request #20452 from Catfish-Man/stringtrampolines 2018-11-15 17:55:34 -08:00
David Smith
8bb6b78e36 Use super trampolines to let us override several more NSString methods (-UTF8String, -cStringUsingEncoding:, and -getCString:maxLength:encoding:) for performance 2018-11-15 17:10:51 -08:00
Lance Parker
4714a74fbe Re-enable iterator benchmarks, remove longSharedPrefix from hashing benchmarks 2018-11-15 11:01:28 -08:00
Philippe Hausler
ff26e96a23 Disable really large Data tests that take a bit too long to run 2018-11-07 15:48:49 -08:00
Philippe Hausler
a66e769b84 [Benchmarks] Add a whole lot more benchmarks for Data (#20396) 2018-11-07 11:25:54 -08:00
David Smith
634e6bc584 Add benchmarks for various ObjC NSString operations on bridged Swift Strings 2018-11-06 13:43:24 -08:00
eeckstein
f64f02bfde Merge pull request #20212 from palimondo/fluctuation-of-the-pupil
[benchmark] Legacy Factor
2018-11-06 11:31:08 -08:00
eeckstein
5f21c12358 Merge pull request #20048 from palimondo/i-just-do-eyes
[benchmark] Extract Setup from Benchmarks
2018-11-05 15:16:32 -08:00
Michael Ilseman
948655e850 [String] Cleanups, comments, documentation
After rebasing on master and incorporating more 32-bit support,
perform a bunch of cleanup, documentation updates, comments, move code
back to String declaration, etc.
2018-11-04 10:42:42 -08:00
Michael Ilseman
d92098bd19 [String] Performance improvements to comparison
Also, disable normalization benchmarks and other changes until we
merge, so we can compare with master 1-to-1.
2018-11-04 10:42:41 -08:00
Lance Parker
7376009ccc Add benchmarks and tests for the normalized iterator (#32)
Add benchmarks and tests for the normalized iterator
2018-11-04 10:42:41 -08:00
Karim Chang
8a5c8b3592 Use the &>> operator in HashTest.
Gets rid of some obvious inefficiencies in this benchmark.
2018-11-02 14:36:25 -04:00
Pavol Vaskovic
f121ee1231 [benchmark] Legacy factor ArraySetElement
Lowered base workload by a factor of 10.
2018-11-01 06:32:06 +01:00
Pavol Vaskovic
435e55f0c0 [benchmark] Legacy factor ArrayOf[Generic]Ref
Lowered the base workload by a factor of 10
2018-11-01 06:29:14 +01:00
Pavol Vaskovic
04d1384b2c [benchmark] Legacy factor AnyHashableWithAClass
Lowered the base workload by a factor of 500
2018-11-01 06:26:40 +01:00
eeckstein
bd59bf10e4 Merge pull request #20123 from palimondo/just-eyes
[benchmark] Reduce unreasonable setup times
2018-10-30 13:47:14 -07:00
Pavol Vaskovic
d8adfc71a1 [benchmark] MapReduceClass2 and NSDecimalNumber
Since this benchmark has been significantly modified and needs to be renamed, we can also lower the workload by a factor of 10, to keep up with the best practices.

The old benchmark that uses `NSDecimalNumber` as the tested class is renamed to `MapReduceNSDecimalNumber` and the renamed `MapReduceClass2` now newly measures Swift class `Box` that wrap an `Int`. Short versions were modified analogously.
2018-10-30 21:23:04 +01:00
Pavol Vaskovic
ca2a52b5e9 [benchmark] Setup CharacterPropertiesPrecomputed
Reduced the time to run the setUpFunction from 2.2s to 380ms on my ancient computer… This should fit well under 200ms on more modern machines.
2018-10-29 16:18:01 +01:00
Michael Gottesman
4d76ff9681 [benchmark] Add two benchmarks that show performance of flattening an array.
The first is a naive imperative approach using appends in a loop. The second
uses flatMap. We would like both of these to have equivalent performance.
2018-10-28 15:55:26 -07:00
Pavol Vaskovic
bfbff45727 [benchmark] Downsized DictionaryKeysContains
The DictionaryKeysContains used unreasonably large dictionary to demonstrate the failed O(n) instead of O(1) performance in case of Cocoa Dictionary. The setup of 1M element dictionary took 8 seconds on my old machine!

The old pathological behavior can be equaly well demonstrated with a much smaller dictionary. (Validated by modifying `public func _customContainsEquatableElement` in `Dictionary.swift` to `return _variant.index(forKey: element) != nil`)

The reported performance with correct O(1) behavior is  unchanged.
2018-10-27 07:34:33 +02:00
Karoy Lorentey
f93dcf3dfa [benchmark] Add benchmark for [AnyHashable: Any] with String keys 2018-10-26 11:56:41 +01:00
Patrick Balestra
1c0778bb5b [benchmark] Add insert(_:Character) benchmark with ASCII and non-ASCII characters
Adds insert character benchmark with ASCII and non-ASCII characters
2018-10-24 18:55:20 -07:00
Pavol Vaskovic
96ff53d5c7 [benchmark] Extract setup: MapReduceClass(Small)
MapReduceClass had setup overhead fo 868 μs (7%).

Setup overhead of MapReduceClassShort was practically lost in the measurement noise from it’s artificially high base load, but it was there.

Extracting the decimal array initialization into `SetUpFunction` also takes out the cost of releasing the [NSDecimalNumber], which turns out to be about half of the measured runtime in the case of MapReduceClass benchmark. This significantly changes the reported runtimes (to about half), therfore the modified benchmarks get a new name with suffix `2`.
2018-10-24 09:12:55 +02:00
Pavol Vaskovic
b55244d558 [benchmark] Extract setup: Sequence *Array benches
Sequence benchmarks that test operations on Arrays have setup overhead of 14 μs. (Up from 4 μs a year ago!) That’s just the creation of an [Int] with 2k elements from a range… This array is now extracted into a constant.

This commit also removes the .unstable tag from some CountableRange benchmarks, restoring them back to commit set of the Swift Benchmark Suite.
2018-10-24 08:59:59 +02:00
Pavol Vaskovic
6b703141e3 [benchmark] Extract setup from SubstringComparable
SubstringComparable had setup overhead of 58 μs (26%).

This was a tricky modification: extracting `substrings` and `comparison` constants out of the run function surprisingly resulted in decreased performance. For some reason this configuration causes significant increase in retain/release traffic. Aliasing the constants in the run function somehow works around this deoptimization.

Also the initial split of the string into 8 substrings takes 44ms!!! (I’m suspecting some king of one-time ICU initialization?)
2018-10-23 23:50:44 +02:00
Pavol Vaskovic
6d3e6377d4 [benchmark] Extract setup from SortSortedStrings
SortSortedStrings had setup overhead of 914 μs (30%).

Renamed [String] constants to be shorter and more descriptive. Extracted the lazy initialiation of all these constants into `setUpFunction`, for cleaner measurements.
2018-10-23 23:37:52 +02:00
Pavol Vaskovic
524de6bec3 [benchmark] Fix setup overhead in RandomShuffle
RandomShuffleLCG2 had setup overhead of 902 μs (17%) even though it already used the setUpFunction. Turns out that copying 100k element array is measurably costly.

The only way to eliminate this overhead from measurement I could think of is to let the numbersLCG array linger around (800 kB), because shuffling the IOU version had different performance.
2018-10-23 23:29:00 +02:00
Pavol Vaskovic
4bc41f8879 [benchmark] Extract setup from PolymorphicCalls
PolymorphicCalls has setup overhead of 4 μs (7%).
2018-10-23 23:07:53 +02:00
Pavol Vaskovic
58a195fd49 [benchmark] Extract setup from Phonebook
Phonebook had setup overhead of 1266 μs (7%).
2018-10-23 23:05:34 +02:00
Pavol Vaskovic
3ff92efdac [benchmark] Extract setup from IterateData
IterateData has setup overhead of 480 μs (10%).

There remained strange setup overhead after extracting the data into setUpFunction, because of of-by-one error in the main loop. It should be either: `for _ 1…10*N` or: `for _ 0..<10*N`. It’s error to use 0…m*N, because this will result in `m*N + 1` iterations that will be divided by N in the reported measurement. The extra iteration then manifests as a mysterious setup overhead!
2018-10-23 22:49:25 +02:00
Pavol Vaskovic
63143d8c3f [benchmark] Extr. Setup DistinctClassFieldAccesses
DistinctClassFieldAccesses had setup overhead of 4 μs (14%).
Plus cosmetic code formatting fix.
2018-10-23 22:33:16 +02:00
Pavol Vaskovic
32003a708c [benchmark] Extract setup in Dictionary(OfObjects)
Dictionary had setup overhad of 136 μs (6%).
DictionaryOfObjects had setup overhead of 616 μs (7%).
Also fixed variable naming convention (lowerCameCase).
2018-10-23 22:28:14 +02:00
Pavol Vaskovic
ae9f5f18b0 [benchmark] Extract setup from DataBenchmarks
DataCount had setup overhead of 18 μs (20%).
DataSubscript had setup overhead of 18 μs (2%).
SetUpFunction wasn’t necessary, because of short initialization (18 μs for `sampleData(.medium)`), which will inflate only the initial measurement.

Runtimes of other benchmarks hide the sampleData initialization in their artificially high runtimes — most use internal multiplier of 10 000 iterations — but were changed to use the same constant data, since it was already available. The overhead will already be extracted if we go for more precise measurement with lower multipliers in the future.
2018-10-23 22:12:22 +02:00
Pavol Vaskovic
03d984114f [benchmark] Extract setup from ArrayInClass
ArrayInClass had setup overhead of 88 μs (17%).
2018-10-23 21:47:04 +02:00
Pavol Vaskovic
53653de575 [benchmark] Extract setup from ArrayAppend*
ArrayAppendStrings had setup overhead of 10ms (42%). ArrayAppendLazyMap had setup overhead of 24 μs (1%).

ArrayAppendOptionals and ArrayAppendArrayOfInt also had barely visible, small overhead of ~18μs, that was mostly hidden in measurement noise, but I’ve extracted the setup from all places that had 10 000 element array initializations, in preparation for more precise measurement in the future.
2018-10-23 21:12:36 +02:00
Pavol Vaskovic
8617745b39 [benchmark] Gardening: extract tags constant 2018-10-23 20:49:56 +02:00
Pavol Vaskovic
4bbb635fca [benchmark] Gardening: Fix copy/paste comments 2018-10-23 20:49:56 +02:00
Erik Eckstein
af71a1b8b6 benchmarks: fix NSStringConversion benchmark
Make sure that the result of the conversion is not optimized away and not moved out of the loop
2018-10-10 09:55:00 -07:00
Soroush Khanlou
5736cacc9a Add count(where:) and tests (#16099)
* add count(where:) and tests

* Revise count(where:) documentation

* Remove errant word in abstract

* add a benchmark for ranges and strings with help from @natecook1000

* update benchmark to use Array instead of Range
2018-09-13 12:37:06 -05:00
Stephen Canon
c1f25e0673 [SE-0225] Implementation of isMultiple for BinaryInteger. (#18689)
* Implement SE-0225 (BinaryInteger.isMultiple(of:))

A default implementation is provided for FixedWidthInteger, with very basic test coverage included.
2018-09-04 10:31:05 -04:00
Chéyo Jiménez
a527e53e17 Renamed DictionaryLiteral to KeyValuePairs (#16577)
* renamed DictionaryLiteral to KeyValuePairs per SE-0214

* renamed DictionaryLiteral type tests to KeyValuePairs

* [SE-0214] Move changelog entry (Swift 4.2 => 5.0)

* [SE-0214] Update comment in AST/Expr.h

* [SE-0214] Use generic typealias

See also <https://github.com/apple/swift/pull/17711>

* [SE-0214] Update source-stability.swift.expected
2018-08-27 10:51:12 -07:00
Karoy Lorentey
11b290c452 [benchmark] SetTests: Move legacy benchmarks to end of list. 2018-08-24 22:35:41 +01:00
Karoy Lorentey
09946d074d [benchmark] SetTest: Add tests for more operations and more cases
- Isolate legacy tests. Add new tests for the same operations, with updated iteration counts and names.
- Rename new tests to follow a consistent naming scheme.
- Add tests for Set.subtracting.
- Add tests on integer sets with 50% and 100% overlap. (isSubset, intersection, union, symmetricDifference, subtracting)
2018-08-24 22:34:05 +01:00
Karoy Lorentey
91dc5c6a73 [benchmark] SetTests: Explain input sets 2018-08-24 17:54:35 +01:00