Skip to content

Commit 670ac2d

Browse files
committed
add blurb about performance
1 parent ac2f2db commit 670ac2d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

proposals/AAAA-stdlib-span-properties.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ extension Foundation.Data {
207207
}
208208
```
209209

210+
#### Performance of the `storage` and `bytes` properties
211+
212+
The `storage` and `bytes` properties should be performant and return their `Span` or `RawSpan` with very little work, in O(1) time. This is the case for all native standard library types. There is a performance wrinkle for bridged `Array` and `String` instances on Darwin-based platforms, where they can be bridged to Objective-C types that do not guarantee contiguous storage. In such cases the implementation will eagerly copy the underlying data to the native Swift form, and return a `Span` or `RawSpan` pointing to that copy.
213+
210214
## Source compatibility
211215

212216
This proposal is additive and source-compatible with existing code.

0 commit comments

Comments
 (0)