Commit Graph

1662 Commits

Author SHA1 Message Date
Valeriy Van
12719bc896 Fix warning in benchmark
warning: 'assign(from:count:)' is deprecated: renamed to 'update(from:count:)'
2023-01-18 21:24:52 +02:00
Valeriy Van
37470915f5 Fix warnings in benchmarks
warning: tuple conversion from '(offset: Int, element: S.Element)' to '(index: Int, elem: S.Element)' mismatches labels
2023-01-18 21:23:16 +02:00
Valeriy Van
3fa1952abc Fix warning in benchmark
warning: immutable value 'i' was never used; consider replacing with '_' or removing it
  for i in 0...N {
      ^
2023-01-18 21:21:04 +02:00
Egor Zhdan
0da22a3420 [cxx-interop] Add benchmark for std::set conversion to a Swift collection 2023-01-16 16:18:07 +00:00
Karoy Lorentey
f56d44a492 [benchmark] Add a basic benchmark for Unicode._CharacterRecognizer
This measures the performance of the stdlib’s core grapheme breaking algorithm, without any `String` overhead.
2023-01-15 16:10:43 -08:00
Egor Zhdan
bd8cf0272c [cxx-interop] Remove manual std::vector conformance in the benchmark
`std::vector::const_iterator` is now automatically conformed to `UnsafeCxxRandomAccessIterator`, and `std::vector` is conformed to `CxxRandomAccessCollection`.

The manually added conformances are now redundant.
2023-01-06 14:10:12 +00:00
Karoy Lorentey
2d9e9b28e9 Revert all changes to Benchmark_Driver 2022-12-30 16:47:48 -08:00
Karoy Lorentey
114d392540 [benchmark] StringDistance: Increase ASCII workload by an additional 10x 2022-12-29 17:15:49 -08:00
Karoy Lorentey
4565485876 [benchmark] Why oh why is this not written in Swift? 2022-12-29 17:12:49 -08:00
Karoy Lorentey
fd01ed6750 [benchmark] StringDistance: Increase ASCII workload 2022-12-28 20:59:17 -08:00
Karoy Lorentey
42f1389c7c [benchmark] Why is this thing not written in Swift? 2022-12-28 20:49:50 -08:00
Karoy Lorentey
54aa1055e5 [benchmark] StringDistance: Add ASCII cases 2022-12-28 15:09:23 -08:00
Karoy Lorentey
3edb03433e [benchmark] StringDistance: Decrease workload 2022-12-28 15:02:49 -08:00
Karoy Lorentey
f6b453f30f [benchmark] Add some distance(from:to:) benchmarks for String views 2022-12-27 23:08:05 -08:00
Anthony Latsis
4cb63c8a0f [NFC] Migrate remnant Jira issue references to GitHub issues 2022-12-04 08:20:34 +03:00
Valeriy Van
8c8593686d OS X -> macOS in swift/benchmark/README.md (#62026) 2022-11-11 12:07:43 +00:00
Tim Kientzle
c056e6396b Merge pull request #61559 from tbkka/tbkka-benchmarking
Overhaul Benchmarking pipeline to use complete sample data, not summaries
2022-11-09 07:38:58 -08:00
fibrechannelscsi
2d052a0826 An additional benchmark for KeyPath read performance. (#61795)
* Added a benchmark for KeyPaths where trivially-typed memory is preceded by non-trivially-typed memory.

* Reduces the workload of run_KeyPathClassStructs by a factor of 4.

The reported time was 1847 us.
2022-11-07 16:52:25 -06:00
Tim Kientzle
961a38b636 Test the non-JSON output
We have to continue using the non-JSON forms
until the JSON-supporting code is universally
available.
2022-11-07 14:46:13 -08:00
Tim Kientzle
dfe8284462 pylint fixes 2022-11-07 14:45:59 -08:00
Tim Kientzle
168130741b Pylint fixes 2022-11-07 14:45:37 -08:00
Andrew Trick
634087d093 Mark ArrayAppendRepeatCol benchmark unstable
It varies by 2x from run-to-run.

We don't yet have a way to control malloc behavior from the driver.
2022-11-07 11:00:13 -08:00
Tim Kientzle
b0ce365b53 A better way to adapt to -num-samples 2022-11-05 16:05:26 -07:00
Tim Kientzle
c3a727486f Make --num-samples actually work 2022-11-05 14:18:41 -07:00
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