* [stdlib] Slice: customize withContiguous[Mutable]StorageIfAvailable
We can easily make an UnsafeBufferPointer that slices another UnsafeBufferPointer, so let’s allow Slice to vend a slice of the base collection’s contiguous storage, if it provides access to one.
We need to do some index distance calculations to implement this, but those will be constant-time in the usual case where the base collection is a RAC.
https://bugs.swift.org/browse/SR-11957
rdar://58090587
* [test] UnsafeBufferPointer: fix some warnings
* [stdlib] Slice: don’t calculate index distances unless the base provides contiguous mutable storage
* Obsolete ModifierSlice typealiases in 5.0
* Obsolete *Indexable in 5.0
* Obsolete IteratorOverOne/EmptyIterator in 5.0
* Obsolete lazy typealiases in 5.0
* Drop .characters from tests
* Obsolete old literal protocols in 5.0
* Obsolete Range conversion helpers in 5.0
* Obsolete IndexDistance helpers in 5.0
* Obsolete Unsafe compat helpers in 5.0
* Obsolete flatMap compatibility helper in 5.0
* Obsolete withMutableCharacters in 5.0
* Obsolete customPlaygroundQuickLook in 5.0
* Deprecate Zip2Sequence streams in 5.0
* Replace * with swift on lotsa stuff
* Back off obsoleting playground conformances for now
* Remove a bunch of Default(Bidirectional|RandomAccess)Indices usage from stdlib and test
* Remove some DefaultRandomAccessIndices and IndexDistance usage from Foundation
* Remove no-longer-used internal type in Existentials.swift
* Get rid of indicesForTraversal
* Eradicate IndexDistance associated type, replacing with Int everywhere
* Consistently use Int for ExistentialCollection’s IndexDistance type.
* Fix test for IndexDistance removal
* Remove a handful of no-longer-needed explicit types
* Add compatibility shims for non-Int index distances
* Test compatibility shim
* Move IndexDistance typealias into the Collection protocol
Top-level entry points fully testing a collection instance:
check${Traversal}Collection
One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).
Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.
Fixes a bug in subscriptRangeTests.
The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.
* Add sliceability tests for Unsafe(Raw)BufferPointer.
Improve the generic sliceability tests to verify that SubSequence indices are
compatible with their parents indices.
* Fix and enable testing stdlib Collection instances.
Top-level entry points fully testing a collection instance:
check${Traversal}Collection
One level of recursion into all slices of the collection instance
O(n^2). (Not combinatorial).
Previously, checkCollection() did nothing. So much of the testing infrastructure was inactive. Now it runs all forward collection tests.
Fixes a bug in subscriptRangeTests.
The UnsafeRawBufferPointer and Data collection testing is disabled and
will be fixed in the following commit.
* Give UnsafeRawBufferPointer a distinct slice type.
SubSequence = RandomAccessSlice<Self>
* Fix raw buffer pointer tests after changing the API
* Add UnsafeRawBuffer(rebasing:) initializers.
Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.
Add and update UnsafeRawBufferPointer unit tests.
* Do not run recursive O(n^2) collection slice testing on large collections.
Now, even with collection unit testing wired up, the validation tests
take the same amount of time to execute.
* Add init(rebasing:) to UnsafeBufferPointer.
This is required for consistency with UnsafeRawBufferPointer.
* Update CHANGELOG.md for SE-0138 amendment: UnsafeRawBufferPointer slice type.
This brings down StdlibUnittest build time to 90 seconds with either
a DebugAssert or a ReleaseAssert compiler.
The new library, StdlibCollectionTests, is only built when running
validation tests.
- Remove free Swift functions for advance and distance and replace
them with protocol extension methods:
- advancedBy(n)
- advancedBy(n, limit:)
- distanceTo(end)
- Modernize the Index tests
- Use StdlibUnittest
- Test for custom implementation dispatch
Perf impact: No significant changes reported in the
Swift Performance Measurement Tool.
rdar://problem/22085119
Swift SVN r30958
- Added CollectionType and SequenceType.swift.gyb
- Added Slice.swift.gyb
- Added a template file for shared lazy flatMap code between sequences
and collections
- Moved some test structs into the respective Check* files in
StdlibUnittest.
- Slice.swift.gyb is still too slow for Debug-Assert stdlib builds.
I've added a requirement to use the optimized standard library but
we should split this file out even further.
rdar://problem/22095015
Swift SVN r30894