Commit Graph

1638 Commits

Author SHA1 Message Date
Tim Kientzle
5c14017bba For size comparisons, build the result objects directly with sample data 2022-11-05 14:17:34 -07:00
Tim Kientzle
e1ab70a4b0 Use results consistently 2022-11-05 13:29:52 -07:00
Tim Kientzle
b8e023ad53 Make the default output a little more like the old version (for now) 2022-11-04 18:07:12 -07:00
Tim Kientzle
a63adc9114 Use non-json format for now until we have switched over completely 2022-11-04 16:17:57 -07:00
Tim Kientzle
2a3e68a1f8 Match new benchmark driver default output 2022-11-04 16:16:37 -07:00
Tim Kientzle
08604eab40 Fix colliding fields; match old format more closely 2022-11-04 16:16:13 -07:00
Tim Kientzle
30b3763211 Fix underflow in the padding calculation 2022-11-04 14:02:03 -07:00
Tim Kientzle
40eaaac0b1 Do not use --json for listing tests (yet) 2022-11-04 14:02:03 -07:00
Tim Kientzle
998475bf80 Pylint cleanup, more comments 2022-11-04 14:02:03 -07:00
Tim Kientzle
b4fa3833d8 Comment some TODO items 2022-11-04 14:02:03 -07:00
Tim Kientzle
071e9f1c7e Python style fixes 2022-11-04 14:02:03 -07:00
Tim Kientzle
520fd79efd Fix some test failures
The new code stores test numbers as numbers (not strings), which
requires a few adjustments. I also apparently missed a few test updates.
2022-11-04 14:02:03 -07:00
Tim Kientzle
971a5d8547 Overhaul Benchmarking pipeline to use complete sample data, not summaries
The Swift benchmarking harness now has two distinct output formats:

* Default: Formatted text that's intended for human consumption.
  Right now, this is just the minimum value, but we can augment that.

* `--json`: each output line is a JSON-encoded object that contains raw data
  This information is intended for use by python scripts that aggregate
  or compare multiple independent tests.

Previously, we tried to use the same output for both purposes.  This required
the python scripts to do more complex parsing of textual layouts, and also meant
that the python scripts had only summary data to work with instead of full raw
sample information.  This in turn made it almost impossible to derive meaningful
comparisons between runs or to aggregate multiple runs.

Typical output in the new JSON format looks like this:
```
{"number":89, "name":"PerfTest", "samples":[1.23, 2.35], "max_rss":16384}
{"number":91, "name":"OtherTest", "samples":[14.8, 19.7]}
```

This format is easy to parse in Python.  Just iterate over
lines and decode each one separately. Also note that the
optional fields (`"max_rss"` above) are trivial to handle:
```
import json
for l in lines:
   j = json.loads(l)
   # Default 0 if not present
   max_rss = j.get("max_rss", 0)
```
Note the `"samples"` array includes the runtime for each individual run.

Because optional fields are so much easier to handle in this form, I reworked
the Python logic to translate old formats into this JSON format for more
uniformity.  Hopefully, we can simplify the code in a year or so by stripping
out the old log formats entirely, along with some of the redundant statistical
calculations.  In particular, the python logic still makes an effort to preserve
mean, median, max, min, stdev, and other statistical data whenever the full set
of samples is not present.  Once we've gotten to a point where we're always
keeping full samples, we can compute any such information on the fly as needed,
eliminating the need to record it.

This is a pretty big rearchitecture of the core benchmarking logic. In order to
try to keep things a bit more manageable, I have not taken this opportunity to
replace any of the actual statistics used in the higher level code or to change
how the actual samples are measured. (But I expect this rearchitecture will make
such changes simpler.) In particular, this should not actually change any
benchmark results.

For the future, please keep this general principle in mind: Statistical
summaries (averages, medians, etc) should as a rule be computed for immediate
output and rarely if ever stored or used as input for other processing. Instead,
aim to store and transfer raw data from which statistics can be recomputed as
necessary.
2022-11-04 14:02:03 -07:00
Alex Lorenz
4e36e2173c Merge pull request #61565 from hyp/eng/benchmark-relinux
[interop] cxx vector benchmark - reenable without SwiftPM support
2022-11-04 09:41:40 -07:00
Alex Lorenz
cd634444c5 [benchmark] markdown report handler - write encoded message to byte buffer 2022-11-03 11:55:27 -07:00
Andrew Trick
f0110201ad Skip DataReplaceLargeBuffer benchmark by default.
Large buffer replacement is too dependent on the system state
to produce a meaningful benchmark score. 30% variation is common.
2022-11-01 18:01:16 -07:00
Alex Lorenz
029ec7abe9 [interop] cxx vector benchmark - reenable it only outside SwiftPM to workaround module serialization issue 2022-10-20 16:13:44 -07:00
Erik Eckstein
6ef5908bdc benchmarks: fix the Fibonacci and Ackermann benchmarks
The `getFalse` utility function was not excluded from cross-module-optimization, which led the optimizer to completely eliminate the main loop body
Also, the passed `N` was shadowed by a local `n`.
2022-10-19 18:09:24 +02:00
Boris Bügling
5eb942ce56 Merge pull request #61574 from apple/neonichu-patch-1
Remove use of deprecated option
2022-10-18 15:51:51 -07:00
Alex Lorenz
e159b1d282 [interop][benchmark] disable CxxVectorSum benchmarks for now until SwiftPM build issue is resolved 2022-10-14 17:08:48 -07:00
Alex Lorenz
b701124b4c [interop] CxxVectorSum benchmark: workaround https://github.com/apple/swift/issues/61472 2022-10-14 14:39:37 -07:00
Boris Bügling
f71eb8e2cb Remove use of deprecated option 2022-10-13 22:47:19 -07:00
Alex Lorenz
c4a9136731 [interop] benchmark - disable linux until https://github.com/apple/swift/issues/61547 is fixed 2022-10-11 12:26:28 -07:00
Alex Lorenz
5b88dc3a8c [interop] benchmark - add a comment to bump up the iteration count 2022-10-10 16:39:17 -07:00
Alex Lorenz
d50f834d78 [interop] vec benchmark - update benchmark naming 2022-10-10 11:39:58 -07:00
Alex Lorenz
3341aef305 [interop] cxx vec benchmark - bump up the iter repeat count 2022-10-10 11:06:30 -07:00
Alex Lorenz
a50939b07e [interop] cxx vec benchmark - initialize vector before benchmark 2022-10-10 11:06:10 -07:00
Alex Lorenz
0e95c759e5 [interop] cxx vector benchmark: do not use subscript until https://github.com/apple/swift/issues/61499 is fixed 2022-10-10 09:14:40 -07:00
Alex Lorenz
ca927dc295 [interop] cxx vector benchmark: iterator is fast with operator == in C++, and subscript is fast with https://github.com/apple/swift/issues/61499 fixed 2022-10-10 09:14:40 -07:00
Alex Lorenz
46342302ff [interop] cxx vector sum benchmark - reduce iterations to avoid long times for slow runs 2022-10-10 09:14:40 -07:00
Alex Lorenz
2a07c1c8ce [interop] benchmark: add run_CxxVectorOfU32_Sum_Swift_RawIteratorLoop that doesn't use C++ inline helpers 2022-10-10 09:13:32 -07:00
Alex Lorenz
157be05c97 [interop] rewrite the C++ vector sum benchmark to have clear naming and take iter into account 2022-10-10 09:13:31 -07:00
Alex Lorenz
d72b592eeb [cxx-interop] Add initial benchmark to compare vector<uint32_t> sum in C++ vs Swift 2022-10-10 09:13:31 -07:00
Dario Rexin
992cae456b [Frontend] Use experimental feature for layout prespecializations (#61451) 2022-10-06 15:21:01 -07:00
Alex Lorenz
e659a52f46 [interop] mark C++ benchmarks with cxxInterop tag for easy local testing 2022-10-03 17:13:10 -07:00
Dario Rexin
25e547e30d [Build] Fix flag in benchmark build 2022-09-22 20:45:11 -07:00
Dario Rexin
210c68d8aa [SILOptimizer] Add prespecialization for arbitray reference types (#58846)
* [SILOptimizer] Add prespecialization for arbitray reference types

* Fix benchmark Package.swift

* Move SimpleArray to utils

* Fix multiple indirect result case

* Remove leftover code from previous attempt

* Fix test after rebase

* Move code to compute type replacements to SpecializedFunction

* Fix ownership when OSSA is enabled

* Fixes after rebase

* Changes after rebasing

* Add feature flag for layout pre-specialization

* Fix pre_specialize-macos.swift

* Add compiler flag to benchmark build

* Fix benchmark SwiftPM flags
2022-09-22 16:29:01 -07:00
Tim Kientzle
48c1931c78 Unbreak delta reporting in benchmarks (#61236)
The logic here was apparently intended to omit literal zeros from deltas
to save a few bytes, but it instead drops all zeros from all columns.
Remove the condition that drops zeros in order to avoid confusing
the many scripts that consume this data.

Alternatives Considered

I'm probably going to entirely drop the delta form in an upcoming
PR, so I didn't think it was worthwhile to do something more complex,
such as:

* Fixing this logic to only omit zeros from actual delta columns

* Rewriting all the client scripts to treat any empty column as zero
2022-09-22 10:22:16 -07:00
Robert Widmann
af9c1bb56f Merge pull request #60770 from YOCKOW/W291
[Gardening] Remove trailing whitespaces in Python scripts. (W291)
2022-08-25 17:23:58 -07:00
YOCKOW
c1e154a9cb [Gardening] Remove trailing whitespaces in Python scripts. (W291)
That has been marked as 'FIXME' for three years.
This commit fixes it.
2022-08-25 16:08:36 +09:00
fibrechannelscsi
730bf24035 Add benchmarks that measure KeyPath read and write performance. (#60383)
* Add benchmarks that measure KeyPath read and write performance.

* Added setUpFunctions. Revised number of iterations per benchmark.

* Include n as a factor in the number of iterations.

* Increased number of iterations for KeyPathDirectAccess by a factor of 25.

* One last tweak to the number of iterations on testDirectAccess to get them above 20 us.

* Made revisions based on feedback. Added three new benchmarks.

* Added benchmarks to exhaustively benchmark all KeyPathComponent types. Removed benchmarks dealing with an inlining issue.

* Wrapped additional keypaths with identity() where needed. More cleanup and documentation.

* Moved KeyPaths for KeyPathRead and Write into FixedSizeArrayHolder. Renamed GetSet to Getset.

* Added inline(never) to both versions of getKeypathToElement().

* Moved identity() wraps so that they're called once per variable per benchmark.

* Moving destinationKeyPaths into FixedSizeArrayHolder to try to reduce long setup overhead errors.

* Additional moving of the identity() wrapping into the singleton's init() to try to reduce setup time errors.
2022-08-24 13:55:05 -05:00
Dario Rexin
4c484af381 [Benchmarks] Disable a few noisy Array benchmarks (#60705) 2022-08-22 13:18:52 -07:00
Mishal Shah
196ee143c5 Xcode 14 beta 4 no longer supports iOS armv7, armv7s, and i386 architectures
> Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)
2022-08-02 20:42:08 -07:00
Erik Eckstein
5c82b8c32f benchmarks: fix some benchmark unstabilities
* disable unstable benchmark `ArrayPlusEqualArrayOfInt`
* scale (by renaming) `SubstringFromLongStringGeneric` by 10
2022-07-25 14:55:42 +02:00
Lily
2eb22789d9 Add benchmarks to measure Dictionary.filter (#59264)
* Add benchmarks for dictionary filtering
2022-06-09 12:04:44 -07:00
Andrew Trick
f09cc8cc8b Fix compare_perf_tests.py for running locally.
The script defaulted to a mode that no one uses without checking
whether the input was compatible with that mode.

This is the script used for run-to-run comparison of benchmark
results. The in-tree benchmarks happened to work with the script only
because of a fragile string comparison burried deep within the
script. Other out-of-tree benchmark scripts that generate results were
silently broken when using this script for comparison.
2022-05-12 16:50:32 -07:00
Zoe Carver
448dd5990d Merge pull request #58533 from zoecarver/disable-benchmark
[nfc] [cxx-interop] Disable `ReadAccessor` benchmark.
2022-04-29 13:07:53 -07:00
zoecarver
f3bb988ea0 [nfc] [cxx-interop] Disable ReadAccessor benchmark. 2022-04-29 10:18:10 -07:00
Josh Soref
fa3ff899a9 Spelling benchmark (#42457)
* spelling: approximate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: benchmarks

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: between

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: calculation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: characterization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: coefficient

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: computation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deterministic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: divisor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: encounter

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: expected

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fibonacci

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: fulfill

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: implements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: into

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intrinsic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: markdown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: measure

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: occurrences

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: omitted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: partition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: performance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: practice

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preemptive

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: repeated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requirements

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: requires

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: response

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: supports

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unknown

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: utilities

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: verbose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-25 09:02:06 -07:00
Erik Eckstein
1fceeab71e benchmarks: prevent some functions from being cross-module optimized.
Function bodies of `blackHole`, `identity`, etc. must not be visible in the benchmark modules.
Enabling CMO by default broke this. Since then we need to explicitly exclude those functions from cross-module-optimization.
2022-04-19 13:59:56 +02:00