-
Notifications
You must be signed in to change notification settings - Fork 10.5k
stdlib: some small Array improvements to prepare for COW representation #32055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci test |
@swift-ci benchmark |
Build failed |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@swift-ci smoke test |
@swift-ci smoke test linux |
In order to fully optimize OptionSet literals, it's important that this function is inlined and fully optimized. So far this was done by chance, but with COW representation it needs a hint to the optimizer.
… an array sub-sequence. In the corner case of a 0 sized replacement in an empty array, we did write the 0 count back to the array singleton. This is not a big problem right now, because it would just overwrite a 0 with a 0, but it shouldn't be done. But with COW representation in Array, it would break the sanity checks.
This has two advantages: 1. It does not force the Array in memory (to pass it as inout self to the non-inlinable _createNewBuffer). 2. The new _consumeAndCreateNew is annotated to consume self. This helps to reduce unnecessary retains/releases. The change applies for Array and ContiguousArray.
@swift-ci smoke test |
@swift-ci smoke test macOS |
1 similar comment
@swift-ci smoke test macOS |
@swift-ci smoke test linux |
This PR contains a set of Array changes which are needed - or beneficial - for the switch to the COW representation in Array types:
For details see the commit messages.