Commit Graph

905 Commits

Author SHA1 Message Date
Karoy Lorentey
a154e46fe1 [benchmark] SetTests: Re-add original tests
The code isn’t the same, but comparisons with previous releases will still be useful (as long as timings match with the original code).
2018-08-24 11:59:54 +01:00
Karoy Lorentey
6426e7e14c [benchmark] SetTests: Better parametrization, separate setup 2018-08-24 11:58:33 +01:00
Karoy Lorentey
ebb5adffba [benchmark] Fix benchmarks for Set operations
- Don’t use a random number generator
- Ensure there is a 25% overlap between sets. Original benchmarks tested non-overlapping sets only.
- Change names; results aren’t directly comparable.
2018-08-23 19:53:31 +01:00
Joe Shajrawi
5e7ea888fb [Exclusivity] Teach MemAccessUtils about Projection Paths
Consider a class ‘C’ with distinct fields ‘A’ and ‘B’

And consider we are accessing C.A and C.B inside a loop

LICM well not hoist the exclusivity checking outside of the loop because isDistinctFrom(C.A, C.B) returns false.

This is because the helper function bails if isUniquelyIdentified returns false (which is the case in class kinds)

Same with all other potential access enforcement optimizations.

This PR resolves that
2018-08-22 18:11:55 -07:00
Kirill Chibisov
248e843d51 Fixed typo in identifier 2018-08-14 06:18:53 +03:00
Kirill Chibisov
b7ff8cf9d3 Fixed some typos 2018-08-13 20:10:30 +03: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
729989473f benchmarks: fix the iteration count for some benchmarks
So that a single iteration is within ~2ms (and also not too short).
2018-07-31 10:59:33 -07:00
Erik Eckstein
868c5a1fb7 benchmarks: Marking some benchmarks as unstable
The noise for those benchmarks even cannot be removed by using a high sample count.
2018-07-31 10:59:33 -07:00
Erik Eckstein
30cc37e5f4 benchmarks: fix the Chars benchmark by adding blackHoles and testing all possible Char comparisons 2018-07-31 10:59:33 -07:00
Erik Eckstein
2839c1707d benchmarks: fix the Calculator benchmark by covering more String compare test cases 2018-07-31 10:59:33 -07: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
Erik Eckstein
50db6f1ed3 benchmarks: fix the setup functions of the CharacterProperties benchmark.
Force all globals to be initialized in the setup functions
2018-07-24 20:20:23 -07:00
Erik Eckstein
f1afba1ad1 benchmarks: adapted some iteration counts and/or workload sizes for benchmarks.
Those are benchmarks which took way too long or short to execute a single iteration or benchmarks which changed in time anyway because of previous fixes.

I renamed those benchmarks so that they are now treated as "new" benchmarks.
2018-07-24 20:20:23 -07:00
Erik Eckstein
f6c24a05cc benchmarks: extract setup code into the setUpFunction in some benchmarks where setup time is significant 2018-07-24 20:20:23 -07:00
Erik Eckstein
8876c24104 benchmarks: add some blackHole calls to prevent the optimizer removing important parts of a benchmark 2018-07-24 20:18:17 -07:00
Erik Eckstein
1a7bee55c6 benchmarks: fix the iteration count of some benchmarks.
Some benchmarks wrongly executed the loop N+1 times ("0...N" instead of "0..<N")

mt
2018-07-24 20:18:17 -07:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Ben Cohen
4694310e51 [stdlib] Some minor cleanup (#18130)
* Remove case destructuring to _

* Remove some Iterator.Element

* Which idiot wrote this? Oh.

* Switch NibbleSort to just use default impls... shouldn't change perf
2018-07-21 17:29:57 -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
Ben Cohen
685f31b0e2 [stdlib] Migrate stdlib tests of Swift 3 (#17427)
* First sweep of Swift 3 stdlib test upgrades

* Review feedback

* Remove a handful more #if >=4.0

* Fix up Dictionary tests
2018-07-08 09:37:01 -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
swift-ci
fd438d5727 Merge pull request #17478 from atrick/exclusivity-bench 2018-06-25 12:10:00 -07:00
Andrew Trick
2b359d1b50 Prevent an exclusivity benchmark from being optimized too much. 2018-06-25 11:25:16 -07:00
Karoy Lorentey
41a8b9c084 [gardening][benchmark] Don't let Emacs modify gyb-generated benchmark sources 2018-06-25 17:16:39 +01:00
Karoy Lorentey
fb541adf9e Merge pull request #17268 from lorentey/benchmark32
Fix benchmark suite on 32-bit platforms
2018-06-18 13:33:44 +01:00
Karoy Lorentey
d66d6b4a84 [benchmark] RandomIntegersLCG: Fix result check on 32-bit platforms
Values returned by random APIs depend on the bitWidth of the underlying integer type; make sure we use a consistent integer width when expecting particular results.
2018-06-15 16:58:05 -07:00
Michael Ilseman
15e869bb9d [benchmark] Non-ASCII variants of UTF-8 decoding inits 2018-06-14 17:06:01 -07:00
Michael Ilseman
763fc064ef [benchmark] Add String.init UTF-8 decoding benchmarks 2018-06-14 12:56:55 -07:00
Michael Gottesman
1124a37307 [benchmark] Add two low level Radix2CooleyTukey benchmarks. 2018-06-01 13:15:45 -07:00
Michael Gottesman
36e0e6949c [benchmark] Add cmake support for compiling the benchmarks standalone on Linux.
To use this, one needs to first build an installable root for swift (i.e. like
the smoke testbot does). Then use the tool ./benchmark/scripts/build_linux.py
with the appropriate locations of the build-directory, installable snapshot,
and it will build the benchmarks. (There are more arguments, just use --help).

rdar://40541972
2018-05-29 14:25:16 -07:00
Michael Gottesman
1466b29dec [benchmark] Disable one benchmark when compiling on Linux.
I was able to run Benchmark_QuickCheck with the out of tree Linux build with
just these tests disabled and everything seems to work.

rdar://40541972
2018-05-29 10:54:19 -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
Michael Gottesman
7f042a7041 Merge pull request #16744 from gottesmm/pr-2e455ec599c163c10ef601ab05763ed442892c5a
[benchmarks] Move StringComparison Workload initialization out of the…
2018-05-19 20:36:09 -07:00
Michael Gottesman
013ae04f8b [benchmarks] Move StringComparison Workload initialization out of the timing loop.
I want to create some larger/more expensive workloads for this. So move all
StringComparison initialization out of the loop just to be standard.

rdar://40371840
2018-05-19 15:53:08 -07:00
Michael Ilseman
440c5b34ba [benchmark] Add reserveCapacity String benchmark to builder.
Add StringBuilderSmallReservingCapacity variant to measure the excess
overhead caused by calls to reserve capacity. If a string is small,
and the capacity is small, this will demonstrate overhead if an
allocation happens.
2018-05-18 19:25:30 -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
Yuta Koshizawa
8afa9b1dcd [benchmark] Fix formatting 2018-05-05 11:17:08 +09: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
Michael Ilseman
5bb2e62280 [benchmark] ArrayAppend for substrings.
Add substring-view-oriented array append benchmarks. Put a
getString/getSubstring call into the innermost loop to prevent some
constant folding towards triviality.
2018-04-30 14:01:51 -07: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
Nate Cook
58933d88c5 [stdlib] Rename index(...) methods to firstIndex(...)
A la SE-204.
2018-04-21 18:07:25 -05:00
Erik Eckstein
7aed128e0b benchmarks: make the benchmarks compilable with the swift 4.1 compiler 2018-04-02 17:38:15 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07: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