Commit Graph

43 Commits

Author SHA1 Message Date
Pavol Vaskovic
ea80003b0c Merge pull request #24307 from palimondo/legacy-factor-doc
[benchmark] Documentation for legacyFactor
2019-04-29 08:02:53 +02:00
Pavol Vaskovic
d2a47db71a [benchmark] Add SplitMix64 PRNG
Very fast pseudorandom number generator with 64 bits of state, conforming to `RandomNumberGenerator` protocol, passing BigCrush.
2019-04-28 19:23:42 +02:00
Pavol Vaskovic
e779e06ba2 [benchmark] Documentation for legacyFactor 2019-04-28 18:23:01 +02:00
Pavol Vaskovic
7896909d23 [benchmark] Move fake autoreleasepool to TestUtils
This workaround for writing cross platform benchmarks is required in multiple performance tests.
2019-02-19 07:50:12 +01:00
Pavol Vaskovic
0ac591e27b [benchmark] Add .existential BenchmarkCategory 2019-02-06 12:38:50 +01:00
Maxim Moiseev
cbf83ac04f [NFC][stdlib] Add FIXME markers to simplify audit 2018-11-14 11:58:42 -08:00
Slava Pestov
f6c2caf64b stdlib: Add @inlinable to @inline(__always) declarations
These should be audited since some might not actually need to be
@inlinable, but for now:

- Anything public and @inline(__always) is now also @inlinable
- Anything @usableFromInline and @inline(__always) is now @inlinable
2018-11-13 15:15:07 -05:00
Pavol Vaskovic
a7f832fb57 [benchmark] Legacy factor
This adds optional `legacyFactor` to the `BenchmarkInfo`, which allows for linear modification of constants that unnecesarily inflate the base workload of benchmarks, while maintaining the continuity of log-term benchmark tracking.

For example, if a benchmark uses `for _ in N*10_000` in its run function, we could lower this to `for _ in N*1_000` and adding a `legacyFactor: 10` to its `BenchmarkInfo`.

Note that this doesn’t affect the real measurements gathered from the `--verbose` output. The `BenchmarkDoctor` has been slightly adjusted to work with these real samples, therefore `Benchmark_Driver check` will not flag these benchmarks for slow run time reported in the summary, if their real runtimes fall into the recommended range.
2018-11-01 06:24:27 +01:00
Erik Eckstein
bd43d54b99 benchmarks: Move the setup and teardown functions out of the sample loop.
This is important to minimize the runtime when many samples are taken.
2018-07-24 20:20:23 -07:00
Pavol Vaskovic
2d004970fd [benchmark] Fix: Running skip-tag-marked benchmark
Also updated benchmark documentation with more detailed description of tag handling.
2018-07-11 23:17:02 +02:00
Pavol Vaskovic
4c4c6a2409 [benchmark] Fix: Better tags in benchmark list
When listing benchmarks with `--list` parameter, present the tags in format that is actually accepted by the `--tags` and `--skip-tags` parameters.

Changes the `--list` output from
````
Enabled Tests,Tags
AngryPhonebook,[TestsUtils.BenchmarkCategory.validation, TestsUtils.BenchmarkCategory.api, TestsUtils.BenchmarkCategory.String]
...
````
into
````
Enabled Tests,Tags
AngryPhonebook,[String, api, validation]
…
````
2018-07-11 23:17:02 +02: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
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
Tony Parker
19c6ccf5af Updated Data benchmarks 2018-03-13 17:29:50 -07:00
Ben Cohen
1e820dc505 Add benchmarks based on different remove(where:) implementations 2018-02-15 16:03:38 -08:00
Karoy Lorentey
c6a4d1131e Make sure string benchmarks actually measure string operations
The optimizer was sometimes able to eliminate most/all of the actual operations, so some benchmarks were not really measuring anything.
2017-11-08 19:15:47 +00:00
Erik Eckstein
46c96978b3 benchmarks: remove deprecated CheckResults function 2017-10-09 16:33:34 -07:00
Max Moiseev
c35cd06c70 Fix a typo 2017-10-04 12:24:21 -07:00
Max Moiseev
86eeb5416b Introduce .skip tag and properly handle --skip-tags parameter 2017-10-03 10:07:50 -07:00
Michael Gottesman
f7681a993a [benchmark] Add support for specifying a benchmark setUp and tearDown function via BenchmarkInfo.
The key thing here is that by providing one of these closures, a benchmark can
inject the initialization/deinitialization of its internal data structures,
outside of the time period where timing is occurring.

The intention is that this will provide us the framework for as we annotate
tests with BenchmarkInfo, to move initialization work out of benchmarks.

It will also allow for more complex benchmarks to be written such as ones that
perform bulk reads from a pipe (my interest in this).
2017-09-28 09:57:46 -07:00
Michael Gottesman
8a69de7332 [benchmark] Have legacy tests use BenchmarkInfo and combine this with registered benches.
*NOTE* We always prefer a registered benchmark if we have one.

I am going to use BenchmarkInfo to solve the "create data for benchmark while we
are already timing" problem. I am going to add a field to BenchmarkInfo that if
it is not-null is called before we start measuring time. This closure can be
used to initialize any global data structures/etc.

But to do this, I need to be able to combine the registered and legacy
not-registered benchmarks.
2017-09-27 12:46:38 -07:00
Michael Gottesman
77acbe82b7 [benchmark] Rename BenchmarkCategories => BenchmarkCategory.
This is an enum that represents a single category of benchmarks. Per the API
guidelines this should really be singular.
2017-09-26 19:28:34 -07:00
Michael Gottesman
45b1609c23 [benchmark] Make BenchmarkCategories a StringEnum.
This ensures that we get BenchmarkCategories <-> String for free and enables the
code that implemented that transform to be deleted.
2017-09-26 19:28:05 -07:00
Michael Gottesman
d6c6ba722a [benchmark] Add some comments to BenchmarkInfo's properties. 2017-09-26 19:04:22 -07:00
Andrew Trick
7a4adbe980 Fix enum indentation. 2017-09-22 21:44:05 -07:00
Joe Shajrawi
ca6ccb4864 Benchmark categorization support 2017-09-22 17:39:04 -07:00
Andrew Trick
2e60052d1d ObjectAllocation is a .cpubench. 2017-09-22 14:52:47 -07:00
Andrew Trick
d9af4c5f45 Introduce BenchmarkInfo and BenchmarkCategories. 2017-09-22 12:49:59 -07:00
Erik Eckstein
fadd2d856f benchmarks: add a getString() utility function.
To be used to prevent constant propagation for benchmark input values.
2017-06-21 17:21:51 -07:00
Erik Eckstein
f657fc5a53 benchmarks: add a getInt() utility function.
To be used to prevent constant propagation for benchmark input values.
2017-06-19 20:30:20 -07:00
eeckstein
087b84e800 Merge pull request #9330 from palimondo/check-results-error-msg
[benchmark] CheckResults with auto-generated error message
2017-05-12 08:47:40 -07:00
practicalswift
764ce41c9a [gardening] Fix a vs an typos. 2017-05-09 20:47:27 +02:00
Dave Abrahams
e32fb8badb Remove interpolated strings from benchmark CheckResults
This call was in many cases skewing the benchmark results.

Note: Intentionally staging this in without removing the old overload initially.
2017-05-05 10:25:02 -07:00
Pavol Vaskovic
dcd98cc04f CheckResults with auto-generated error message
In order to minimize impact of results checking on test performance, this removes the @autoclosure for error message.

Added new version of `CheckResults` that takes only `resultsMatch: Bool` - rest of the parameters are defaulted to `StaticString`s for method and file name, plus line number. Old method was deprecated, but left in place as tool for debugging failing checks. All tests were move to use the new method.
2017-05-05 14:08:13 +02:00
Erik Eckstein
fc4b5fa25d benchmarks: add a blackHole function, which can be used to prevent the optimizer to remove a result of a computation.
It’s similar to the _blackHole function in the stdlib unit tests.
2017-05-03 09:05:44 -07:00
Pavol Vaskovic
76327e097d Adressed formatting nits 2017-04-05 09:44:57 +02:00
Pavol Vaskovic
096f028e89 Lazily compute error message only when the condition fails 2017-03-30 11:09:34 +02:00
Mikio Takeuchi
593155f78b Make benchmarks compile and run on Linux 2017-03-06 17:13:47 +09:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Luke Larson
0356ec8ec3 Add Swift Benchmark Suite 2016-02-08 10:47:58 -08:00