-
Notifications
You must be signed in to change notification settings - Fork 15
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
simple array buffer #82
Conversation
522ca30
to
97a8df6
Compare
ce8223d
to
dc5fba0
Compare
These mutation functions allow the buffer's elements to be mutated in place without incurring spurious CoW.
2d7c58e
to
6fc353a
Compare
public init<SrcStorage>(_ src: AnyArrayBuffer<SrcStorage>) { | ||
self.storage = unsafeDowncast(src.storage, to: Storage.self) | ||
/// - Requires: `p` is the address of an initialized `ArrayStorage<Element>`. | ||
public static func asStorage(_ p: UnsafeRawPointer) -> ArrayStorage<Element> { |
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.
Why is p
an UnsafeRawPointer
instead of an AnyObject
?
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.
Mostly fear of ARC
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.
IMO we should try the AnyObject arrangement and see if it slows anything down. If not, maybe that's better.
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.
Looks good to me! I migrated SwiftFusion to this and it works. A few "feature requests" are in Sources/SwiftFusion/Inference/PenguinExtensions.swift in the migration PR but we can do them in subsequent PRs.
No description provided.