Commit Graph

1638 Commits

Author SHA1 Message Date
Erik Eckstein
c70970c60f benchmarks: fix the handling of the --help command line option
It displayed the help if the option was _not_ specified.
2018-05-29 12:47:08 -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
cee593c267 [benchmark] Add a small --help menu to the low level driver that just dumps the current valid options list.
We probably should have added this sooner...
2018-05-29 00:03:46 -07:00
Michael Gottesman
fab1630fdf Merge pull request #16874 from gottesmm/pr-4b615a53246f430a2aa930207041f82738eac2a3
[benchmark] Move build configuration/sdk configuration out of the main CMakeLists.txt file into AddSwiftBenchmarkSuite.cmake.
2018-05-28 20:51:37 -07:00
Michael Gottesman
5f8209e02d Merge pull request #16872 from gottesmm/pr-6ca8783e222690b6bd1095fa5c8eac02efb5f0fe
[benchmark] Add the ability for a benchmark to specify that it does n…
2018-05-28 20:24:02 -07:00
Michael Gottesman
9740bef838 [benchmark] Move build configuration/sdk configuration out of the main CMakeLists.txt file into AddSwiftBenchmarkSuite.cmake.
I am going to add some support here for Linux. I want to make sure that these
changes are hidden from the main CMakeLists.txt file since we want that file to
be as declarative as possible.

rdar://40541972
2018-05-28 18:39:43 -07:00
Michael Gottesman
61fa5d94ec [benchmark] Add some banners that show the organization of the file cmake file.
rdar://40541972
2018-05-28 18:39:42 -07:00
Michael Gottesman
d3778565ee [benchmark] Remove out of date comment. NFC. 2018-05-28 18:18:52 -07:00
Michael Gottesman
45b7743086 [benchmark] Add the ability for a benchmark to specify that it does not run on specific platforms.
Today, one can not completely disable a benchmark depending on the platform
without changing the source of main.swift. We would like to be able to disable
benchmarks locally in a benchmark's file without needing to modify the rest of
the infrastructure. The closest that one can get to such behavior is to just
conditionally compile out the file locally. But one still will have the test
run.

This commit adds support for not-running the benchmark on specific
platforms. This in combination with conditional compilation of benchmark bodies,
allows us to not have to comment out module's in main.swift or have to
conditionally compile testinfo.

rdar://40541972
2018-05-28 18:12:58 -07:00
swift-ci
fdc733c3cc Merge pull request #16862 from gottesmm/pr-9639bbef7f37872add1dd046cdf3a81b9682e021 2018-05-27 11:41:58 -07:00
Michael Gottesman
8a2c9bc715 Fix obvious typo... = /.
rdar://40541972
2018-05-27 18:12:33 +00: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
ad82fe6c70 Merge pull request #16828 from gottesmm/pr-84e7c044a8d49ddcb70f6fc1535e1309e96c6a27
[func-sig-opts] Add a regression benchmark that shows overhead from +…
2018-05-24 22:56:49 -07:00
Michael Gottesman
09e1e20546 [benchmark][cmake] Move runcmd from AddSwiftBench* => SwiftBenchmarkUtils.cmake.
A quick NFC cleanup that I saw.

rdar://40541972
2018-05-24 18:15:33 -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
Michael Gottesman
d7fc0e1170 [benchmark] Enable users of Benchmark_QuickCheck to select a specific opt level to run from the command line. 2018-03-25 10:46:13 -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
Max Moiseev
c4e2b548dc [benchmark] Add a benchmark for .lazy.filter,map chaining...
... and functionally equivalent single call to .lazy.compactMap.

See https://forums.swift.org/t/introduce-lazy-version-of-compactmap/9835
for more info.
2018-03-20 11:54:18 -07:00
Karoy Lorentey
a7d529c230 Merge pull request #15339 from lorentey/deterministic-benchmarks
[benchmark] Driver: stabilize Dictionary/Set benchmarks
2018-03-19 22:11:19 +00:00
Karoy Lorentey
77fa298276 [benchmark] WordCount: Use a unified buildWorkload() func
setUpFunction code should be located together with the corresponding runFunction code, so that we can verify them at a glance. However, we can't really do that yet, and doing the setUp for all tests in bulk makes it less likely that we make a mistake in matching up tests with their corresponding setups. :/
2018-03-19 18:46:29 +00:00
Karoy Lorentey
11515c1676 [benchmark] Driver: stabilize Dictionary/Set benchmarks
Disable the random hash seed while benchmarking. By its nature, it makes the number of hash collisions fluctuate between runs, adding unnecessary noise to benchmark results.

I expect we'll be able to re-enable random seeding here once we have made hash collisions cheaper -- they are currently always resolved by calling the Key's Equatable implementation, which can be expensive.
2018-03-19 17:38:29 +00:00
Karoy Lorentey
ea99af40b3 [benchmark] WordCount: Also blackHole WordSplit tests, for good measure 2018-03-19 15:06:23 +00:00
Karoy Lorentey
872efe151b [benchmark] WordCount: Initialize global variables in setUpFunction.
WordCount shows significant variance between iterations, which is apparently caused by the initialization of someAlphanumerics and asciiWords/utf16Words leaking into the measured part of the benchmark.

Making sure these variables are initialized before we start measuring elapsed time stabilizes the results.
2018-03-19 14:51:29 +00:00
Michael Gottesman
30dd85d386 [benchmark] Add a new utility script called Benchmark_QuickCheck.
This benchmark script is similar to the guard malloc/runtime runner, but it only
runs the tests. The intention is that one can use this to quickly in a
multithreaded way verify that all benchmarks run successfully. In contrast, the
normal driver will run only single threaded since it is meant to test
performance, so is not able to take advantage of all cores on a system.

I wrote this quickly to verify some benchmark tests still worked. No point in
not sharing with everyone else.
2018-03-17 11:39:52 -07:00
Karoy Lorentey
06c33c0ca8 [benchmark] FloatingPointPrinting: Fix benchmark failures 2018-03-16 18:12:40 +00:00
Karoy Lorentey
93c0411d34 Merge pull request #15073 from lorentey/dictionary-swapat
[benchmark] Add benchmarks for Dictionary.swapAt(_:,_:)
2018-03-15 21:02:24 +00:00
Andrew Trick
b2d96ddab5 Bypass Float80 benchmarks on Windows. 2018-03-15 13:34:40 -07:00
tbkka
848de7e84c Benchmark {Float,Double,Float80}.description (#15234)
* Benchmark {Float,Double,Float80}.description

This just tests how fast we can format the standard
floating-point types.  It also includes a test that
uses the result, to ensure that future optimized
_creation_ of the string doesn't incidentally pessimize
_use_ of the results.

* Benchmark {Float,Double,Float80}.description

This just tests how fast we can format the standard
floating-point types.  It also includes a test that
uses the result, to ensure that future optimized
_creation_ of the string doesn't incidentally pessimize
_use_ of the results.

* Add benchmarks for values close to 1 + other review suggestions
2018-03-15 14:09:35 -04:00
Tony Parker
130ce14f16 Merge pull request #15221 from parkera/parkera/data_benchmarks
Updated Data benchmarks
2018-03-15 09:01:18 -07:00
Tony Parker
bfa0be99e7 Use blackHole to ensure inner loops are not optimized away; switch subscript benchmark to 10000*N style 2018-03-14 12:39:12 -07:00
Tony Parker
19c6ccf5af Updated Data benchmarks 2018-03-13 17:29:50 -07:00
Karoy Lorentey
e642a3fe08 [benchmark] Fix issues uncovered in review 2018-03-13 20:38:46 +00:00
Karoy Lorentey
c2eccf2b4d [benchmark] Add benchmarks for Dictionary operations with quadratic behavior
Dictionary and Set currently exhibit O(n^2) behavior for certain operations involving copying elements in bulk. Add benchmarks to verify an upcoming fix and to catch regressions later.

https://bugs.swift.org/browse/SR-3268
2018-03-13 19:42:45 +00:00
Andrew Trick
55021a8a0f Add a benchmark cmake flag SWIFT_RUNTIME_ENABLE_LEAK_CHECKER.
This is necessary to build standalone benchmarks with leak checking
enabled. This is useful if you want to debug an internal benchmark failure using
a public swift.
2018-03-08 20:13:58 -08:00
Karoy Lorentey
80b36d271b [benchmark] Add benchmarks for Dictionary.Values.swapAt(_:,_:) 2018-03-08 12:44:11 +00:00
Michael Ilseman
7f1ba5d22d Merge pull request #14992 from milseman/bench_builder
[benchmark] More StringBuilder/Interpolation benchmarks
2018-03-06 15:09:01 -08:00