Skip to content
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

[SR-14982] UnsafeMutableRawBufferPointer.initialize(as:from: ) has no fast path for contiguous Collections #57324

Closed
glessard opened this issue Jul 27, 2021 · 5 comments
Assignees
Labels
improvement performance standard library Area: Standard library umbrella

Comments

@glessard
Copy link
Contributor

Previous ID SR-14982
Radar rdar://problem/81168547
Original Reporter @glessard
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement, Performance
Assignee @glessard
Priority Medium

md5: 604b61efa14e93fd1f56dd2bcf00a48f

Issue Description:

UMRBP.initializeMemory<T,S>(as type: T.Type, from source: S) takes a Sequence and and initializes an UMRBP element-by-element (see here). Note that the closest equivalent function on UnsafeMutableRawPointer is the most likely way to add a fast-path for this, by using withContiguousStorageIfAvailable on source.

Adding a fast path may require adding an overload.

@glessard
Copy link
Contributor Author

UMRP isn't the only way to fast-path this: UMBP<T>.initialize(from: ) is also viable, and might work for more Collection types.

@glessard
Copy link
Contributor Author

@swift-ci create

@glessard
Copy link
Contributor Author

(this is thematically related to [SR-14886| https://bugs.swift.org/browse/SR-14886])

@glessard
Copy link
Contributor Author

#38817

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@glessard
Copy link
Contributor Author

This has been resolved in a different way in SE-0370, by implementing a separate method to initialize from a collection: UnsafeMutableRawBufferPointer.initialize(as:fromContentsOf:).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement performance standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant