-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Replace custom Deque
implementation with swift-collection Deque
#67277
Conversation
@swift-ci please test |
@swift-ci please smoke test |
LGTM about getting the swift-collection's deque. This keeps it internal so that's fine, but maybe prepare a pitch as well to make it part of stdlib? It is used all over the place being copied around 🤔 WDYT @lorentey ? If we intend to keep this copy around like this though, would it be good to automate copying the files a bit so it is easier to keep the two impls in sync? Or working towards removing the one in swift-collections in favor or a public pitched one from the stdlib. |
Yeah it would be great if we could get |
Up to @lorentey to give the thumbs up or down here perhaps. |
Yes, this is clearly an interim solution. Manually vendoring these implementations into every single ABI stable OS component is not going to be a good approach in the long term. The big blocker for adding Until we're ready to do that though, this is the best we can do! 👍 Mechanically copying a known-good implementation is better than having multiple parallel reimplementations of the same thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend adding prominent comments at the top of source files pointing to their upstream location, to try prevent things from diverging too much from upstream.
In case the _Concurrency module ends up needing to make substantial changes/fixes to this code, those ought to be propagated back into the swift-collections package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed thoughts @lorentey! Looks good then.
Maybe a README or something in the Deque directory pointing at https://github.com/apple/swift-collections/tree/main/Sources/DequeModule could do it as well?
@swift-ci please smoke test |
@swift-ci please test |
@swift-ci please smoke test |
@swift-ci please test |
@swift-ci please test macos |
@swift-ci please smoke test |
@swift-ci please test |
# Motivation For AsyncStream we created a custom internal Deque implementation to use for the buffering. This implementation was relatively bare-bones compared to the one in swift-collections. Furthermore, it lacked some methods that we need to implement the new `AsyncStream` APIs that support producer backpressure. # Modification This PR copies over the Deque implementation of swift-collections and makes it internal and non-inlinable. # Result We now have a fully functional Deque.
@swift-ci please smoke test |
@swift-ci please test macos |
Motivation
For AsyncStream we created a custom internal Deque implementation to use for the buffering. This implementation was relatively bare-bones compared to the one in swift-collections. Furthermore, it lacked some methods that we need to implement the new
AsyncStream
APIs that support producer backpressure.Modification
This PR copies over the Deque implementation of swift-collections and makes it internal and non-inlinable.
Result
We now have a fully functional Deque.