Commit Graph

38 Commits

Author SHA1 Message Date
Egor Zhdan
9f3dad4096 [cxx-interop] Workaround a compiler crash on Ubuntu 22.04
Swift is crashing on Ubuntu 22.04 when compiling benchmarks for `std::span`.

rdar://136875225
2024-10-04 17:26:00 +01:00
Egor Zhdan
0005b95ed6 Merge pull request #76782 from swiftlang/egorzhdan/benchmark-bump-size
[cxx-interop] Increase the size of `std::string`s in benchmarks
2024-10-02 17:29:45 +01:00
Egor Zhdan
e6e5524fb1 [cxx-interop] Increase the size of std::strings in benchmarks
Since https://github.com/swiftlang/swift/pull/75608, the performance of `std::string` <=> `Swift.String` conversions improved significantly. To make sure the workload is significant enough for the benchmark results to be noise-free, this bumps the size of Swift strings that are being tested.
2024-10-01 13:24:35 +01:00
Egor Zhdan
3ff51016a6 [cxx-interop] Workaround a modularization issue in benchmarks
`import CxxStdlib` should not be required, since `CxxStdlibPerformance` transitively imports the C++ stdlib, but having the explicit import works around a modularization issue (rdar://128520766).

rdar://136330247
2024-09-27 19:32:01 +01: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
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
Egor Zhdan
7bdd9dd84a [cxx-interop] Enable benchmarks in SwiftPM mode
The C++ interop benchmarks were only running when building with CMake, not with SwiftPM, because of a bug that was only triggering with SwiftPM. That bug seems to be fixed now.
2024-07-24 13:38:38 +01:00
Egor Zhdan
0bfd5722d4 [cxx-interop] Re-enable benchmarks
This adds an `import CxxStdlib` statement which fixes compilation. It should be redundant, but it works around a bug that got exposed by an change in explicit modules (rdar://128520766).

This will bring back the performance numbers while the underlying issue is being investigated.
2024-07-19 17:15:46 +01:00
Egor Zhdan
2b7e470d5d Revert "[cxx-interop] benchmark, disable ReadAccessor benchmark while investigating build regression after rebranch"
This reverts commit 157632fd9f.
2023-12-26 17:49:07 +00:00
Alex Lorenz
157632fd9f [cxx-interop] benchmark, disable ReadAccessor benchmark while investigating build regression after rebranch 2023-10-24 15:21:04 -07:00
Egor Zhdan
d5f5d4bd55 [cxx-interop] Make CxxConvertibleToCollection.forEach public
This allows clients to iterate over a C++ container which doesn't provide random access with a `.forEach` call.

rdar://107995558
2023-04-18 14:43:43 +01:00
Egor Zhdan
34c2b0e50d [cxx-interop] Make String.init(std.string) unlabeled
`Swift.String` can be initialized from any other type with an unlabeled initializer, which is either going to use the `CustomStringConvertible` conformance, or reflection. We would like clients to use the most suitable initializer, which is the one that takes `std.string` as a parameter. For instance, that allows us to attach a doc comment to the initializer.

This change makes the initializer unlabeled to make sure it is chosed by overload resolution when a client invokes `String(myCxxString)`.
2023-02-02 12:47:08 +00: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
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
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
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
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
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
Alex Lorenz
e659a52f46 [interop] mark C++ benchmarks with cxxInterop tag for easy local testing 2022-10-03 17:13:10 -07:00
Egor Zhdan
626eadcf64 [cxx-interop] Import size_t as Int instead of UInt on Linux
When using libc++, Swift imports `size_t` as Int despite `size_t` being an unsigned type. This is intentional & is specified in `lib/ClangImporter/MappedTypes.def`. Previously, MappedTypes were only honored for C/C++ types declared on the file level.

In libstdc++, `size_t` is declared within `namespace std` and not on the file level, so the mapping to Int was not applied.

This change ensures that MappedTypes are also applied to types declared in `namespace std`.
2022-03-24 15:29:19 +00:00
Nuri Amari
cda2c26d8c Create ReadAccessor benchmark
Create a benchmark to test the
performance of synthesized read
accessors generated to interop
with C++ [] operators.
2022-03-07 10:19:25 -05:00
Karoy Lorentey
8944591e71 [benchmark] Simplify benchmark registration 2021-09-15 22:08:08 -07:00
Karoy Lorentey
8910b75cfe [benchmark] Stop capitalizing function and variable names 2021-09-15 22:08:07 -07:00
zoecarver
01b12cfe6e [cxx-interop] Add support for benchmarks with C++ interop.
* Adds support for benchmarks that use C++ modules.
* Adds "CreateObjects" benchmark that creates C++ objects.
2020-10-06 19:33:22 -07:00