Commit Graph

1681 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
Steven Wu 72c8c21104 [build-script] Add --enable-caching support with clang-cache and Swift compilation caching
Add a new --enable-caching option that enables compilation caching for both
C/C++ (via clang-cache as compiler launcher) and Swift code (via
-cache-compile-job flags when bootstrapping=hosttools).

New options:
- --enable-caching: main toggle, incompatible with --sccache/--distcc
- --caching-cas-path: CAS directory (default: $BUILD_ROOT/cas)
- --caching-depscan-socket: depscan daemon socket path
- --caching-plugin-path: CAS plugin library path
- --caching-plugin-option: CAS plugin options (repeatable)
- --caching-prefix-map: enable source/SDK/toolchain prefix mapping
- --caching-remote-service-path: remote caching service with auto
  plugin inference from Xcode and implied prefix mapping

The build script starts a clang-cache depscan daemon with reliable cleanup
via atexit and SIGTERM handlers. Per-product build directories get .cas-config
and compilation-prefix-map.json files written automatically.

Caching flags are applied to all Swift host compilation targets: compiler
sources, pure-swift host libraries (ASTGen, macros), swift-syntax, and
the new runtime build when --build-runtime-with-host-compiler is used.

When not using --caching-remote-service-path, enables CAS backend
(-Xfrontend -cas-backend -Xllvm -cas-friendly-debug-info) unless
SWIFT_CACHE_DISABLE_MCCAS is set.

A ninja wrapper is generated at build/<subdir>/build-utils/ninja for
cached incremental builds outside the build-script.

rdar://155876033

Assisted-By: Claude
2026-04-29 14:42:17 -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
Owen Voorhees fbe454b784 Update benchmark package to remove assumptions about build dir layour 2026-03-20 08:56:32 -07:00
Owen Voorhees 93cb025990 Replace use of unsafeFlags with headerSearchPaths in benchmarks 2026-03-19 23:52:19 -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
Slava Pestov 7c70ce175a Monoids: Adopt ~Copyable in a trivial way and fix resulting exclusivity violations 2026-01-08 09:30:06 -05: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
eeckstein ed63ede90a Merge pull request #82606 from valeriyvan/Benchmark_Driver-format
Fix bug Benchmark_Driver writing benchmark log in unsupported format
2025-12-17 18:33:58 +00: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
Slava Pestov 0730b91205 Merge pull request #84401 from slavapestov/one-more-monoid-benchmark-fix
Fix a slightly non-deterministic behavior in the Monoids benchmark
2025-09-19 22:34:57 -04:00
Slava Pestov 575c7097f6 Fix a slightly non-deterministic behavior in the Monoids benchmark
When built with output enabled, sometimes a few lines would be
interchanged, depending on the order in which parallel tasks
complete. Simplify the dispatcher logic a bit to ensure we get
the same output ordering every time.

This does not impact the running time of the benchmark.
2025-09-19 17:07:10 -04: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
Slava Pestov d7864301b6 Benchmarks: Remove DispatchSemaphore hack from Monoids benchmark 2025-08-27 10:37:10 -04: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
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
Slava Pestov 4d7adea1e2 One final round of small cleanups for Monoids benchmark 2025-08-18 17:35:31 -04:00
Erik Eckstein ce86f65272 benchmark script tests: make the match string for invalid option errors more flexible
Because the actual output depends on the python version
2025-07-25 15:21:49 +02:00
Slava Pestov 68b044abb8 Benchmarks: Set deployment target to Swift 5.5-era Apple OSes
We can probably bump this further, but at the very least this allows
the use of basic concurrency features.
2025-07-23 17:26:49 -04:00
Slava Pestov 56f6c09afd Benchmarks: Fix multi-source benchmarks
The swiftpm build was broken and it only worked if there was exactly
one multi-source benchmark. Use the correct subdirectory for each one.
2025-07-23 17:26:48 -04:00
Slava Pestov e6b77812ef New "Monoids" benchmark 2025-07-23 17:26:48 -04: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 8d83ddddf5 Fix bug writing output in unsupported format 2025-06-28 23:17:03 +03: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
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
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
Ian Anderson 15345ef2d5 [CMake][Darwin] Remove support for building the SDK overlays on Apple platforms
The SDK overlays have been provided in the Apple SDKs for many years, and the interface and implementation has diverged in more recent years such that trying to build the Swift version no longer works. Remove all of the dead code.

rdar://151889154
2025-05-23 23:38:08 -07: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
John Hui ff596d5932 Revert "[cxx-interop] Temporarily exclude CxxSetToCollection benchmark from the build (#81145)"
This reverts commit 86c30d6b58.
2025-04-30 18:36:57 -07:00
Egor Zhdan 86c30d6b58 [cxx-interop] Temporarily exclude CxxSetToCollection benchmark from the build (#81145)
This is needed to unblock nightly toolchains, which are currently failing to build with an assertion:
```
swift-frontend: /home/build-user/build/buildbot_linux/llvm-linux-x86_64/tools/clang/include/clang/AST/TypeNodes.inc:79: TypeInfo clang::ASTContext::getTypeInfoImpl(const Type *) const: Assertion `!T->isDependentType() && "should not see dependent types here"' failed.
```

rdar://150067288
2025-04-29 09:57:39 -07:00
Meghana Gupta ec97a16281 Disable C++ interop benchmarks 2025-04-22 11:25:02 -07:00