Commit Graph

237 Commits

Author SHA1 Message Date
Cory Benfield
b43bfa88c0 [benchmark] Add ChaCha20-based performance benchmark
This patch adds a benchmark to the Swift benchmark suite based on the
ChaCha20 encryption algorithm.

As Swift evolves it is important that it tackles more and more features
and possible use cases. One of these great use-cases is low-level CPU
intensive code, and cryptographic algorithms are a really important
test-bed.

This benchmark therefore provides a real-world test case for Swift's
optimiser. My ideal outcome here is that Swift should be able to perform
as well at this benchmark as a naive equivalent C implementation.
2019-10-15 16:33:21 -07:00
Michael Gottesman
b4e25f9274 [benchmark] Add versions of prims that in a non-efficient way uses various forms of non-strong references.
Specifically, I add some benchmarks for weak, unowned, unsafe (unowned), and
unmanaged. The reason for the split in between unsafe (unowned) and unmanaged is
that one is testing the raw compiler features and the other is validating stdlib
performance.
2019-09-10 18:32:44 -07:00
Michael Gottesman
d128664244 Merge pull request #26744 from weissi/jw-bench-find-string
benchmark: add naive string finding
2019-08-29 19:02:04 -07:00
Johannes Weiss
f758d22ff7 benchmark: add naive string finding
FindStringNaive is a simple benchmark which implements a naive String
finding algorithm that currently shows a lot of ARC traffic, hopefully
to be reduced in the future.
2019-08-28 19:57:13 +01:00
Andrew Trick
7e9b46ee03 Add SortArrayInClass benchmark.
This currently copies the array each time it swaps elements. This
makes it 1500x slower than it should be to sort the array. The
benchmark now runs in 15ms but should be around 10us when fully
optimized.

This algorithm is an interesting optimization problem involving array
optimization, uniqueness, bounds checks, and exclusivity. But the
general first order problem is how to modify a CoW data structure
that's stored in a class property. As it stands, the property getter
retains the class property around the modify accesses that checks
uniqueness.
2019-08-15 16:32:37 -07:00
Pavol Vaskovic
22d7c289be Merge pull request #25310 from keitaito/string-benchmarks
[benchmark] Add ReplaceSubrange benchmark
2019-08-03 01:04:26 +02:00
Scott Perry
3e2e4f8b6f Clean up the Diffing and Diffing.Myers benchmarks 2019-07-16 14:39:16 -07:00
Scott Perry
0fc5d6ad31 Performance improvements and availability updates for Collection.difference(from:using:) 2019-06-26 16:55:29 -07:00
Keita Ito
459861b1d4 Rename ReplaceSubrange to StringReplaceSubrange 2019-06-11 00:03:21 -07:00
Keita Ito
0f6d56c9e6 Add ReplaceSubrange benchmark 2019-06-07 16:36:06 -07:00
Johannes Weiss
7226dca81f benchmark: NIOChannelPipeline imitation
adds a benchmark that imitates SwiftNIO's ChannelPipeline. Recently,
Swift master regressed on this benchmark, therefore I believe adding it
to Swift provides value as it seems to be different enough to the existing
benchmarks.
2019-05-14 21:03:03 +01:00
Patrick Pijnappel
150bcb0503 [benchmark] Add integer parsing benchmarks 2019-05-04 09:17:42 +10:00
Raj Barik
34fbbcc842 Merge pull request #24206 from rajbarik/raj-bench
Performance Benchmarking of ExistentialSpecializer
2019-04-26 08:55:29 -07:00
Michael Ilseman
2022b5c566 Merge pull request #24210 from troughton/floating-point-parsing-benchmark
[benchmark] Add a benchmark for floating point parsing performance
2019-04-25 15:13:38 -07:00
Raj Barik
2f32778de4 Performance Benchmarking of ExistentialSpecializer 2019-04-25 10:38:36 -07:00
Thomas Roughton
4b50c3ef3e [benchmark] Add a benchmark for floating point parsing performance 2019-04-24 13:31:23 +12:00
Michael Ilseman
32a2031a19 [benchmark] View variants for CSVParsing
Generalize CSVParsing so that it can be ran across all of String's
views, and add corresponding benchmarks.

Note: This does change the profile of the original benchmark, which
was an odd mixture of String and UTF16View.
2019-04-22 15:37:53 -07:00
David Smith
d2a59e0edf Add new benchmarks for NSString bridging to cover non-tagged cases 2019-03-21 14:17:39 -07:00
Patrick Pijnappel
06a2e6d5d2 [test] Add Range overlaps benchmark 2019-03-14 20:26:28 +11:00
Pavol Vaskovic
539f2cdcdf [benchmark] Remove DoubleWidthDivision (dead code) 2019-03-01 20:40:18 +01:00
Pavol Vaskovic
16af31a39b [benchmark] Remove HashQuadratic
This was obsoleted by DictionaryCopy.
2019-02-17 07:09:14 +01:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Patrick Balestra
fecff67e3e [benchmark] Sort registerBenchmark statements alphabetically 2019-01-20 22:00:26 +01:00
Lance Parker
15aaa1e777 [stdlib]String normalization functions (#21026)
* fast/foreignNormalize functions
2019-01-08 13:55:29 -08:00
David Smith
f85e1fee22 Generalize the JSON perf tests to Codable 2018-12-03 11:16:47 -08:00
David Smith
c129066b39 Add simple benchmarks for JSON coding 2018-11-29 17:41:50 -08: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
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
Michael Gottesman
ba7815b663 [benchmark] Fix swiftpm based benchmark build on Linux. 2018-10-29 12:15:20 -07: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
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
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
Kirill Chibisov
38db0d7ce2 Added benchmark for heapSort path of stdlib sort
This benchmark makes sorting benchmarks more complete. Now we
can measure all paths of stdlib sorting function.
2018-08-13 16:11:01 +03:00
Erik Eckstein
53f2660e62 benchmarks: Convert the PartialApplyDynamicType into a lit test
This benchmark was added to test if the compiler crashes.
For some reason it was added as benchmark and not as lit test.
It has no value as benchmark anyway because the compiler optimizes away pretty much everything.
2018-07-25 11:32:23 -07:00
Daiki Matsudate
a3552f393e [stdlib] Add compactMapValues(_:) to Dictionary (#15017)
add compact map values on hashed collections
2018-07-14 22:35:16 -07:00
Karoy Lorentey
b954e6068d [benchmark] Add NSDictionary benchmarks for dictionaries bridged from Swift 2018-07-05 11:28:27 +01:00
Lance Parker
cdf9ab6657 hashing benchmarks for String 2018-07-02 17:44:50 -07:00
Michael Gottesman
7dbfaa2eff [benchmark] Change the swiftpm pm package to conditional ObjectiveCNoBridgingStubs on Xcode and SWIFT_PACKAGE.
Otherwise while xcrun swift build will work, a generate xcodeproject from
swiftpm will not.
2018-06-05 21:56:11 -07:00
Michael Gottesman
0a70ec336a [benchmark] Add swiftpm support for the benchmark suite.
This means that we can now edit benchmarks in Xcode! Keep in mind:

1. This is not an official build. It is just so we can use Xcode to edit files
and get IDE features.
2. I had to do a little hackery to keep the build the way it is today where all
single-source files are their own modules.
3. As long as we do not change the directory structure, everything should just
update and work since I added a little code that dynamically adds the tests.

Also, to do this I had to rename multi-source/PrimsSplit/main.swift =>
Prims_main.swift. That is because the name main.swift is special in some way and
I hit linker errors. By simply changing the name from main.swift =>
Prims_main.swift, everything is good. I am going to file a separate bug for
that.
2018-06-03 23:50:27 -07:00
Michael Gottesman
1124a37307 [benchmark] Add two low level Radix2CooleyTukey benchmarks. 2018-06-01 13:15:45 -07:00
Michael Gottesman
4ddeba123d Merge pull request #16832 from gottesmm/pr-769c02db89f9caceec9c48e9e9f081fe78655b9a
[func-sig-opts][+0->+1] Add a benchmark that requires the optimizer t…
2018-05-24 22:57:03 -07:00
Michael Gottesman
0629afc3fe [func-sig-opts][+0->+1] Add a benchmark that requires the optimizer to propagate a +1 value from an opaque entry point through a simple linear call tree.
rdar://38196046
2018-05-24 18:12:05 -07:00
Michael Gottesman
1d5aca44f2 [func-sig-opts] Add a regression benchmark that shows overhead from +1->+0 without a corresponding +0->+1 optimization.
rdar://38196046
2018-05-24 16:16:42 -07:00
Karoy Lorentey
d282b1c541 Merge pull request #16413 from Azoy/random-unification
[stdlib] Random unification
2018-05-10 11:41:48 +01:00
Ben Rimmington
b65d0c1d11 Consolidate _stdlib_random functions (#2)
* Use the `__has_include` and `GRND_RANDOM` macros

* Use `getentropy` instead of `getrandom`

* Use `std::min` from the <algorithm> header

* Move `#if` out of the `_stdlib_random` function

* Use `getrandom` with "/dev/urandom" fallback

* Use `#pragma comment` to import "Bcrypt.lib"

* <https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp>
* <https://clang.llvm.org/docs/UsersManual.html#microsoft-extensions>

* Use "/dev/urandom" instead of `SecRandomCopyBytes`

* Use `swift::StaticMutex` for shared "/dev/urandom"

* Add `getrandom_available`; use `O_CLOEXEC` flag

Add platform impl docs

Update copyrights

Fix docs

Add _stdlib_random test

Update _stdlib_random test

Add missing &

Notice about _stdlib_random

Fix docs

Guard on upperBound = 0

Test full range of 8 bit integers

Remove some gyb

Clean up integerRangeTest

Remove FixedWidthInteger constraint

Use arc4random universally

Fix randomElement

Constrain shuffle to RandomAccessCollection

warning instead of error

Move Apple's implementation

Fix failing test on 32 bit systems
2018-05-09 00:21:44 -05:00
Nate Cook
f146d17214 Revise documentation, add benchmarks (#3)
* [stdlib] Revise documentation for new random APIs

* [stdlib] Fix constraints on random integer generation

* [test] Isolate failing Random test

* [benchmark] Add benchmarks for new random APIs

Fix Float80 test

Value type generators

random -> randomElement

Fix some docs

One more doc fix

Doc fixes & bool fix

Use computed over explicit
2018-05-04 21:03:50 -05:00
Yuta Koshizawa
903f55b45b [benchmark] Add DictionaryKeysContains 2018-05-03 01:22:31 +09:00
Karoy Lorentey
ec91f6b6d6 [benchmark] Replace hashValue implementations with hash(into:)
This gives us a better picture of expected hashing performance.

Add a new benchmark to track legacy hashValue performance.
2018-04-25 19:17:16 +01:00
Max Moiseev
9ee2fe9b10 Merge pull request #15376 from moiseev/filter-map-filter-map
[benchmark] Add a benchmark for .lazy.filter.map chaining...
2018-03-20 14:53:22 -07:00