Commit Graph

498 Commits

Author SHA1 Message Date
Xiaodi Wu
57cf4ce563 [benchmark] Add integer-to-string benchmark (#85209)
A companion to #85180.

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-11-03 11:05:26 -05:00
Aidan Hall
8632e58825 Create Pack Specialisation pass 2025-10-30 14:28:16 +00:00
Erik Eckstein
60efd32283 benchmarks: Remove the StackPromo benchmark and make it a lit test
This benchmark just wants to test if stack promotion of an array literal works.
This is so simple that it's better tested with a lit test.
2025-10-10 14:20:59 +02:00
Slava Pestov
48eddac961 Benchmarks: Add support for async benchmarks 2025-08-27 10:37:10 -04:00
Slava Pestov
2ec19ecb46 Benchmarks: Skip long benchmarks in -Onone build 2025-08-27 10:37:10 -04:00
Slava Pestov
e6b77812ef New "Monoids" benchmark 2025-07-23 17:26:48 -04:00
Gabor Horvath
3dda301496 [cxx-interop] Reenable C++ benchmarks
The underlying issue was fixed in #82309

rdar://149402670
2025-06-24 17:57:42 +01:00
Meghana Gupta
ec97a16281 Disable C++ interop benchmarks 2025-04-22 11:25:02 -07:00
Alastair Houghton
f2e48bd293 Merge pull request #76257 from AreaZR/e
Use instancetype for the benchmark and SwiftNativeNSObject
2024-11-14 14:18:00 +00:00
Nate Cook
e12e968570 Add contains(_:) methods to (Closed)Range (#76891)
The _StringProcessing module provides a generic, collection-based
`contains` method that performs poorly for ranges and closed ranges.
This addresses the primary issue by providing concrete overloads
for Range and ClosedRange which match the expected performance for
these operations.

This change also fixes an issue with the existing range overlap tests.
The generated `(Closed)Range.overlap` tests are ignoring the "other"
range type when generating ranges for testing, so all overlap tests
are only being run against ranges of the same type. This fixes things
so that heterogeneous testing is included.
2024-11-12 11:47:24 -08:00
smonteiro2
6ed0091630 [cxx-interop] Benchmarks for std::span in Swift
* std::span is not supported in swift-ci linux
* explicitly pass -std=c++20 in Package.swift: rdar://136138941
2024-09-17 17:48:56 +01:00
Artem Chikin
9c28427eff Revert "[cxx-interop] Create benchmarks for using std::span in Swift" 2024-09-10 10:18:42 -07:00
Artem Chikin
21d5a7dfda Revert "[cxx-interop] Fix check to include std::span"
This reverts commit 2b90ea3bda.
2024-09-10 10:18:29 -07:00
smonteiro2
2b90ea3bda [cxx-interop] Fix check to include std::span 2024-09-10 14:01:43 +01:00
smonteiro2
6239c10cc6 [cxx-interop] Create benchmarks for using std::span in Swift
* swift-ci linux tests do not support std::span
2024-09-09 12:47:08 +01:00
Rose
7f2787e249 Use instancetype for the benchmark and SwiftNativeNSObject
This is more for consistency than anything else, really.
2024-09-04 13:07:04 -04:00
Alex Hoppen
c3ded9a035 Revert "[cxx-interop] Create benchmarks for using std::span in Swift" 2024-09-03 18:03:54 -07:00
smonteiro2
796ccb7df0 [cxx-interop] Create benchmarks for using std::span in Swift
* swift-ci linux tests do not support std::span
2024-08-30 16:39:57 +01:00
Nate Chandler
88c5fc17b2 [Benchmark] Disable Cxx{VectorSum,SetToCollection}.
The two benchmarks don't currently build in some configurations.  Also
disabled building ReadAccessor whose running had previously been
disabled because it doesn't build anymore.

rdar://128520766
2024-06-06 07:23:37 -07:00
Mykola Pokhylets
6298d41edf Reapply "Fix quadratic performance of the ListMerger in specific usage pattern"
This reverts commit 2640ff613b.
2024-05-30 13:08:42 +02:00
Andrew Trick
2640ff613b Revert "Fix quadratic performance of the ListMerger in specific usage pattern" 2024-05-21 16:23:57 -07:00
Mykola Pokhylets
69f54501d4 Added benchmark for adding jobs to default actor when visiting a tree 2024-05-10 11:05:22 +02:00
Nate Cook
38e1370884 Revert "Revert count(where:)" (#70816)
* Revert "Revert count(where:)"

This reverts commit 779ea19a6a.

Now that SE-0220 has been re-accepted, this adds the `count(where:)` 
Sequence method to the standard library.
2024-03-29 13:53:53 -05:00
cui fliter
127077b3aa chore: fix some comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-03-05 17:23:22 +08:00
Oscar Byström Ericsson
e6cc57f321 FlattenSequence/distance(from:to:) benchmarks (v2).
1. Registered the new benchmarks in benchmark/utils/main.swift.
2024-02-22 10:11:41 +01:00
Oscar Byström Ericsson
0ea89852da FlattenSequence/distance(from:to:) benchmarks (#71648). 2024-02-21 17:33:30 +01:00
Max Desiatov
21a2b78801 stdlib/benchmark: add canImport(Musl) where needed (#67120)
This allows compiling stdlib and benchmarks when targeting musl instead of Glibc.
2023-07-05 19:55:08 +01:00
Lucy Satheesan
51c62aee19 [benchmark] add removeAll(keepingCapacity: true) non-unique test 2023-05-23 11:05:59 -07:00
David Smith
9b3bd5ed0a register new benchmarks 2023-05-09 15:33:09 -07:00
Valeriy Van
dd22e6a43c Removes slash from benchmrk name.
Slash in benchmark name makes benchmarks break.
2023-02-28 11:35:31 +02:00
Valeriy Van
bfb1e875af Adds benchmark for String(repeating:count:) 2023-02-28 11:35:31 +02:00
Valeriy Van
fa6c038c92 Adds benchmarks for UTF16 decoding 2023-02-14 12:04:29 +02:00
swift-ci
afe43a4699 Merge pull request #63106 from valeriyvan/Benchmark-UnsafeRawBufferPointer-first
[benchmark] Add benchmark for UnsafeMutableRawBufferPointer firstIndex(of:) and lastIndex(of:)
2023-01-31 21:34:52 -08:00
Egor Zhdan
d288b16420 [cxx-interop] Add benchmark for conversion between C++ and Swift strings 2023-01-25 00:17:49 +00:00
Egor Zhdan
99c54addb3 Merge pull request #62648 from apple/egorzhdan/cxx-set-bench
[cxx-interop] Add benchmark for std::set conversion to a Swift collection
2023-01-24 23:45:21 +00:00
Valeriy Van
136baafa50 Add benchmark for UnsafeMutableRawBufferPointer firstIndex(of:) and lastIndex(of:) 2023-01-19 18:34:14 +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
f6b453f30f [benchmark] Add some distance(from:to:) benchmarks for String views 2022-12-27 23:08:05 -08: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
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
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
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
Alex Lorenz
a50939b07e [interop] cxx vec benchmark - initialize vector before benchmark 2022-10-10 11:06:10 -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
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