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.
`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
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.
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.
`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)`.
`std::vector::const_iterator` is now automatically conformed to `UnsafeCxxRandomAccessIterator`, and `std::vector` is conformed to `CxxRandomAccessCollection`.
The manually added conformances are now redundant.
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`.