Commit Graph

932 Commits

Author SHA1 Message Date
Slava Pestov deacce8bf9 New congruence enumeration benchmark 2026-05-14 11:29:58 -04:00
David Smith 5039cccf80 Add a cross-encoding version of strcmp, use it in bridged String equality, and expose it for Foundation's use (#87271)
There's a longstanding problem in implementing `-isEqualToString:`,
where if you don't know how to get fast access to the other NSString's
contents, you have to pick between doing it character by character (very
slow), or calling [other isEqualToString: self], which risks infinite
recursion if the other string does the same.

This cuts the gordian knot by adding a new method
`isEqualToBytes:encoding:count:`, so you can get the contents out of
`self`, and hand it to the other string, confident that it will not need
to (nor, in fact be able to) ask you anything that might recurse.
2026-05-07 02:10:44 -07:00
Konrad `ktoso` Malawski 5610a52296 [Concurrency] Make TaskLocal.get inlinable (#88334) 2026-04-10 07:40:07 +09:00
David Smith def9ee7464 Introduce a "single breadcrumb mode" for Strings decoded from UTF16. (#83987)
This allows us to quickly answer .utf16.count without requiring
additional allocations

Fixes rdar://160656317
2026-03-26 18:09:18 -07:00
Dario Rexin 7a6b8e4313 Merge pull request #87887 from drexin/wip-task-group-perf
[Concurrency] Improve performance of task groups
2026-03-17 00:38:51 -07:00
Dario Rexin e19c33affd [Concurrency] Improve performance of task groups
rdar://172192966

The tasks of a task group were stored in a singly linked list, causing a
linear scan for a task to find its predecessor, whenever a task completed
and had to be removed from the list. This change turns it into a doubly
linked list, so the linear scan is avoided completely.
2026-03-16 13:47:17 -07:00
Meghana Gupta 50f7a3cc86 Merge pull request #87813 from meg-gupta/spanbmk
Add some simple Span and MutableSpan benchmarks
2026-03-16 10:07:57 -07:00
Meghana Gupta cc58a071f7 Add some simple Span and MutableSpan benchmarks 2026-03-11 22:16:31 -07:00
Konrad `ktoso` Malawski 900f6906cd [Concurrency] make enqueue forwarding chain inlinable (#87611)
The inlinable certainly wont hurt on these "forwarding" methods, though
I was not able to confirm a noticable difference at least using this
benchmark.

Since adding those is definitely good anyway, I didn't dig much further,
let's just add them.

Assisted by: claude to make the benchmark, manually verified all changes
ran benchmarks and checked results etc
2026-03-02 08:35:20 -08:00
Karoy Lorentey 747ec1282b Merge pull request #82439 from vanvoorden/dictionary-identical
[SE-0494][StdLib] Add `isTriviallyIdentical(to:)` Methods to Dictionary and Set
2025-12-17 13:56:05 -08:00
Karoy Lorentey 05d4565146 Merge pull request #82438 from vanvoorden/array-identical
[SE-0494][StdLib] Add `isTriviallyIdentical(to:)` Methods to Array, ArraySlice, and ContiguousArray
2025-12-17 13:54:30 -08:00
Rick van Voorden 048091d6f2 [stdlib] array identical
Co-Authored-By: Ben Rimmington <me@benrimmington.com>
2025-12-08 17:39:01 -08:00
Rick van Voorden 8c9f084d86 substring test nits 2025-12-08 17:35:51 -08:00
Karoy Lorentey a7b152b94b [benchmark] Remove new benchmarks 2025-12-08 17:32:19 -08:00
Rick van Voorden abae2f6547 [stdlib] string identical
Co-Authored-By: Karoy Lorentey <klorentey@apple.com>
2025-12-08 17:32:19 -08:00
Rick van Voorden 15c020272a [stdlib] dictionary identical 2025-12-08 16:47:37 -08:00
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
Nate Cook 80f052e251 [stdlib] Switch to a linear-space variant of Myers diffing (#83212)
This changes the implementation for `Collection.difference(from:)` to
use a linear-space complexity variation of the same Myers algorithm. The
new version is similar in execution time to the existing one, but should
alleviate memory pressure when diffing collections where the number of
differences approaches the size of the collection. While the new
algorithm returns a set of changes that is the same size as the previous
version, the specific changes are not guaranteed to be the same.

rdar://155829876
2025-09-19 10:03:26 -07:00
Nate Cook a14dbd2fd0 Add and enable another large diffing benchmark (#83832)
Enabling both of these despite the long runtime so that I can get an
accurate measure of the change with the new diffing implementation.
After #83212 is merged I will disable these large benchmarks again.
2025-08-21 09:23:29 -05:00
Nate Cook a390f026b9 Add a diffing benchmark with large inputs (#83248) 2025-07-23 10:54:29 -07:00
eeckstein 22536978c2 Merge pull request #82600 from valeriyvan/WarningObjectiveCBridging
Fix unused var warning in benchmark
2025-07-01 22:49:18 +02:00
eeckstein a3c49524a8 Merge pull request #82599 from valeriyvan/WarningDiffingMyers
Fix warning in benchmark: generic parameter 'C' shadows generic parameter from outer scope with the same name; this is an error in the Swift 6 language mode
2025-07-01 13:44:36 +02:00
Valeriy Van b0f46de8b1 Fix unused var warning in benchmark 2025-06-28 17:48:46 +03:00
Valeriy Van 568364cd88 Fix warning
warning: generic parameter 'C' shadows generic parameter from outer scope with the same name; this is an error in the Swift 6 language mode
2025-06-28 17:45:16 +03:00
David Smith 1a56da655f Native implementation of -lengthOfBytesUsingEncoding, plus handling ASCII-subset MacRoman in a few places (#81791)
Fixes rdar://154341146
2025-06-27 13:48:10 -07:00
Stephen Canon 76df55d1aa Quiet a deprecation warning in the count(where:) benchmark (#82257)
I think the benchmarking machinery moved while count(where:) was in
limbo, so this was deprecated before the benchmark actually landed.
2025-06-17 08:58:34 -04:00
David Smith e795eb0d13 Cache the last ObjC bridging conformance we looked up (#81545)
Fixes rdar://151475392
2025-05-16 11:00:13 -07: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
David Smith a861fc117b Add benchmarks for withContiguousStorageIfAvailable on bridged NSArrays (#75215) 2024-07-16 00:24:23 -07:00
Alexander Cyon cb55dbbb96 Fix typo 'defne' -> 'define'. 2024-07-07 18:22:14 +02:00
Alexander Cyon 9d04bfd848 [benchmark] Fix typos 2024-07-06 13:17:13 +02:00
Karoy Lorentey ad3d3ad045 [benchmark] Update/fix availability checks 2024-06-13 18:00:45 -07:00
David Smith 5b81405a75 Add new benchmarks for UTF16 transcoding (#74229) 2024-06-08 15:21:22 -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
Guillaume Lessard 7ed54c903c Merge pull request #71786 from oscbyspro/better-joined-distance-from-to-benchmarks
FlattenSequence/distance(from:to:) benchmarks.
2024-02-24 16:59:25 -08:00
Oscar Byström Ericsson 8cfbb62a2e FlattenSequence/distance(from:to:) benchmarks (v7).
The benchmarks took too long to perform, so I reduced the size of each payload.
2024-02-24 08:18:33 +01:00
Oscar Byström Ericsson 7ecb987ad5 FlattenSequence/distance(from:to:) benchmarks (v6).
1. The auto-generated [BenchmarkInfo] was given the wrong name.
2024-02-23 10:11:18 +01:00
Oscar Byström Ericsson cef7c43daf FlattenSequence/distance(from:to:) benchmarks (v5).
1. Replaced occurrences of Repeated<T> with Array<T>.
2024-02-22 20:45:03 +01:00
Oscar Byström Ericsson dff27479bf FlattenSequence/distance(from:to:) benchmarks (v4).
1. Added some sequential tests with String as the inner collection.
2024-02-22 17:31:28 +01:00
Oscar Byström Ericsson 6829f808a0 FlattenSequence/distance(from:to:) benchmarks (v3).
1. Parameterized benchmark dependencies, per code review.
2024-02-22 17:25:29 +01:00
Oscar Byström Ericsson 0ea89852da FlattenSequence/distance(from:to:) benchmarks (#71648). 2024-02-21 17:33:30 +01:00
David Smith f1feba0e42 Eytzingerize word break data (#71731)
Switch word break property searching to Eytzinger binary search
2024-02-20 22:49:34 -08:00
Tim Kientzle dc7a3d38cd Fix HTTP2StateMachine benchmark
The optimizer managed to eliminate this entire benchmark,
resulting in useless 0 second timings.

I made a couple of changes to ensure the optimizer cannot
eliminate the loop:
* The individual checks now actually use the loop parameter
* `identity()` is used to ensure conservatism

While here, I reduced the loop count since these benchmarks seem
to run for a long time.
2023-09-22 17:50:51 -07:00
Manu 02b5fa2c8e Fix some typos in the codebase 2023-08-31 18:50:10 -03: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