Releases: apple/swift-collections
Swift Collections 1.3.0
This feature release supports Swift toolchain versions 6.0, 6.1 and 6.2, and it includes the following improvements:
BasicContainers
module
This new module collects ownership-aware, low-level variants of existing data structures in the core standard library. In this release, this module consists of two array variants, UniqueArray
and RigidArray
.
These new types are provided as less flexible, noncopyable alternatives to the classic Array
type. The standard Array
implements value semantics with the copy-on-write optimization; this inherently requires elements to be copyable, and it is itself copyable.
struct UniqueArray<Element>
is a noncopyable array variant that takes away Array
's copy-on-write behavior, enabling support for noncopyable elements. This type's noncopyability means mutations can always assume that the array is uniquely owned, with no shared copies (hence the name!). This means that array mutations such as mutating an element at an index can behave much more predictably, with no unexpected performance spikes due to having to copy shared storage.
struct RigidArray<Element>
goes even further, by also disabling dynamic resizing. Rigid arrays have a fixed capacity: they are initialized with room for a particular number of elements, and they never implicitly grow (nor shrink) their storage. When a rigid array's count reaches its capacity, it becomes unable to add any new items -- inserting into a full array is considered a programming error. This makes this a quite inflexible (or rigid) type indeed, as avoiding storage overflow requires careful, up front planning on the resource needs of the task at hand. In exchange, rigid arrays can have extremely predictable performance characteristics.
UniqueArray
is a great default choice when a task just needs an array type that is able store noncopyable elements. RigidArray
is best reserved for use cases that require absolute, pedantic control over memory use or latency -- such as control software running in environments with extremely limited memory, or when a certain task must always be completed in some given amount of time.
The Unique
and Rigid
prefixes applied here establish a general naming convention for low-level variants of the classic copy-on-write data structure implementations. Future releases are expected to flesh out our zoo of container types by adding Unique
and Rigid
variants of the existing Set
, Dictionary
, Deque
, Heap
and other constructs, with type names such as as RigidDictionary
and UniqueDeque
.
TrailingElementsModule
module
This new module ships a new TrailingArray
construct, a preview of a new low-level, ownership-aware variant of ManagedBuffer
. This is primarily intended as a interoperability helper for C constructs that consist of a fixed-size header directly followed by variable-size storage buffer.
ContainersPreview
module
This module is intended to contain previews of an upcoming ownership-aware container model. In this initial release, this module consists of just one construct: struct Box<T>
.
Box
is a wrapper type that forms a noncopyable, heap allocated box around an arbitrary value.
What's Changed
- Merge release/1.1 to main by @lorentey in #204
- Merge relase/1.1 to main, without taking any changes by @lorentey in #206
- [Heap] Add methods to replace minimum/maximum (redux) by @lorentey in #208
- Persistent collections updates (part 10) by @lorentey in #207
- Update CMakeLists.txt by @compnerd in #215
- Merge latest changes from release/1.1 to main by @lorentey in #220
- Merge branch release/1.1 to main by @lorentey in #231
- [SortedCollections] Disable tests with @testable imports in release builds by @lorentey in #232
- [Hashtable] Minor Documentation Fix (Typo) by @nickkohrn in #241
- Merge branch
release/1.1
tomain
by @lorentey in #248 - Update README.md by @glessard in #251
- [OrderedDictionary] Explicitly mention in documentation that keys/values are ordered by @warpling in #254
- build: support ARM64 spelling by @compnerd in #282
- Merge release/1.1 to main by @lorentey in #284
- Update release checklist by @lorentey in #323
- build: update the build rules for adjusted tree layout by @compnerd in #331
- build: support using swift-collections in larger projects by @compnerd in #330
- Merge release/1.1 to main by @lorentey in #332
- build: support building in Debug mode on Windows by @compnerd in #333
- Bugfix Incorrect Assert in BTree.removeFirst/removeLast by @LeoNavel in #349
- Fix typos by @rex4539 in #356
- Merge branch
release/1.1
tomain
by @lorentey in #358 - Merge.1.1βmain by @lorentey in #361
- Add post-merge CI support by @shahmishal in #367
- Update CODEOWNERS by @lorentey in #375
- Merge release/1.1 to main by @lorentey in #386
- Merge release/1.1 to main by @lorentey in #410
- [BTree][NFC] Rephrase some comments by @lorentey in #427
- [CI] Pull Request testing support via GitHub Actions by @shahmishal in #426
- [OrderedDictionary Documentation] fix a typo by @Gyuni in #445
- Install swiftmodules with full module triple by @etcwilde in #470
- [OrderedSet] Add
OrderedSet.appending(contentsOf:)
by @pm-dev in #452 - ManagedBuffer.capacity is unavailable on OpenBSD. by @3405691582 in #456
- Align Heap._UnsafeHandle min/maxValue tie-breaking with Swift.min/max by @DakshinD in #455
- Add Heap.removeAll(where:) by @DakshinD in #454
- Merge release/1.2 to main by @lorentey in #450
- Disable
SortedCollections
module by @lorentey in #479 - Enable MemberImportVisibility and fix issues uncovered by @lorentey in #480
- fix comment for OrderedSet.appending(contentsOf:) by @ozumin in #478
- Bump requirements of nested benchmarking package by @lorentey in #481
- Fix CMake build by @etcwilde in #482
- Merge changes on
release/1.2
tomain
branch by @lorentey in #487 - Enable macOS testing on GitHub Actions by @shahmishal in #483
- Fix API documentation links in README.md by @azarovalex in #490
- Skip Xcode 16.0 and 16.1 in PR workflow by @natecook1000 in #493
- Fix OrderedSet example usage by @azarovalex in #491
- Add support for embedded Swift mode by @parkera in #494
- Include DequeModule in the Foundation toolchain build by @cthielen in #495
- Fix CMake build for
release/1.2
by @cthielen in #498 - fix minor typo in init docs for Deque.swift by @t089 in #503
- [SortedSet] Fix subtreeCount inconsistency after remove at index by @brianchang928 in #502
- Add the missing COLLECTIONS_SINGLE_MODULE when import InternalCollectionsUtils by @faimin in #501
- [SortedCollections] Fix incorrect offset calculation in BTree.findAnyIndex by @brianchang928 in #506
- [SortedCollections] Fix B-tree root reduction during element removal causing data loss by @brianchang928 in #507
- Add checks for Wasm compatibility to
pull_request.yml
by @MaxDesiatov in #509 - First round of noncopyable constructs:
Box
,RigidArray
,DynamicArray
by @lorentey in #508 - [actions] exclude Xcode 26 beta 6 by @glessard in #514
- Add "trailing elements" module with facilities for tail-allocated storage by @DougGregor in #513
- [Xcode] Add trailing elements to xcodeproj by @Azoy in https://github.com...
Swift Collections 1.1.6
This is a patch release updating the CMake build configuration that is used to build Swift toolchains. There were no changes to the package.
What's Changed
Full Changelog: 1.1.5...1.1.6
Swift Collections 1.2.1
This is a patch release with the following minor improvements:
BigString
sometimes miscounted distances in its character view, resulting in an invalid collection conformance. This is now fixed. (#485)BigString
's Unicode Scalar and character views now make better use of known lengths of the text chunks stored in the tree, resulting in significantly improved performance for their distance measurements. (#486)- The Foundation-specific toolchain configuration was updated to include the Deque type. (#496)
What's Changed
- [BigString] Fix character indexing operations by @lorentey in #485
- [BigString] Harvest some low-hanging performance fruit by @lorentey in #486
- Include DequeModule in the Foundation toolchain build by @cthielen in #496
Full Changelog: 1.2.0...1.2.1
Swift Collections 1.1.5
This is a patch release updating the CMake build configuration that is used to build Swift toolchains. There were no changes to the package.
What's Changed
Full Changelog: 1.1.4...1.1.5
Swift Collections 1.2.0
This feature release includes the following improvements:
- The package now compiles without warnings using Swift 6.0 and 6.1.
- New functionality:
- Bug fixes and performance improvements:
This version supports Swift toolchain versions 5.10, 6.0 and 6.1.
What's Changed
- Set up release/1.2 branch by @lorentey in #423
- Optimize unspecialized
OrderedSet.init
andOrderedSet.firstIndex(of:)
by @dnadoba in #433 - fix amd64 support by @michael-yuji in #447
- [cmake] Install libraries in standard directories by @Steelskin in #446
- [1.2][OrderedDictionary] fix a typo by @lorentey in #449
- [release/1.2] [CI] Add support for GitHub Actions by @shahmishal in #453
- Reimplement
_specialize(_:for:)
for the 5.9 stdlib by @lorentey in #472 - Add .editorconfig by @lorentey in #471
- Cherry pick recent PRs destined for 1.2 by @lorentey in #473
- Drop support for the Swift 5.9.* toolchains by @lorentey in #475
- [Rope] Resolve deprecation warnings on
String.Index._description
by @lorentey in #474
New Contributors
- @dnadoba made their first contribution in #433
- @michael-yuji made their first contribution in #447
- @Steelskin made their first contribution in #446
Full Changelog: 1.1.4...1.2.0
Swift Collections 1.1.4
This patch release consists of changes to the (unstable) CMake configuration. It includes no code level modifications.
This is expected to be the last planned release in the 1.1 release series. The next tagged release will be 1.2.0, bumping the required Swift toolchain to 5.9.
What's Changed
- Add more file in Sources/BitCollections/CMakeLists.txt by @lamtrinhdev in #419
- [Build] Use
SWIFT_SYSTEM_NAME
rather than just lowercasing. by @al45tair in #421 - [CMake] Handle riscv64 by @futurejones in #422
New Contributors
- @lamtrinhdev made their first contribution in #419
- @al45tair made their first contribution in #421
- @futurejones made their first contribution in #422
Full Changelog: 1.1.3...1.1.4
Swift Collections 1.1.3
This patch release ships bug fixes for issues discovered since 1.1.2.
What's Changed
- [BigString] Fix accidentally quadratic
BigString.init
by @lorentey in #405 - add 'final' keyword to class by @quokkaKyu in #403
- [CMake] Add support for WebAssembly target architectures by @kateinoigakukun in #408
- [concurrency] conform Deque.Iterator to unchecked-Sendable by @glessard in #414
New Contributors
- @quokkaKyu made their first contribution in #403
- @kateinoigakukun made their first contribution in #408
Full Changelog: 1.1.2...1.1.3
Swift Collections 1.1.2
This patch release updates the (unstable) CMake build configuration to support the swift-foundation project.
There were no changes outside of the CMake configuration.
What's Changed
- Install the Foundation toolchain module during the static swift build by @jmschonfeld in #391
- [CMake] Reduce path lengths in single-module build by @jmschonfeld in #392
- Reduce the size of the _FoundationCollections toolchain module by @jmschonfeld in #395
Full Changelog: 1.1.1...1.1.2
Swift Collections 1.1.1
This patch release resolves issues uncovered since version 1.1.0 was published.
What's Changed
- This version fixes a bogus assertion in
Deque
that can cause incorrect runtime traps in debug builds. (#381) - The unstable module
_CollectionsUtilities
was renamed toInternalCollectionsUtilities
to work around an issue in shipping versions of Xcode. This renaming is not intended to make this module public -- it remains an unstable implementation detail. (#364)
New Contributors
- @iCharlesHu made their first contribution in #373
- @jmschonfeld made their first contribution in #385
Many thanks to our contributors for their work!
List of Pull Requests
Full Changelog: 1.1.0...1.1.1
- Update README by @lorentey in #360
- Add post-merge CI support for release/1.1 branch by @shahmishal in #368
- Rename RopeModule to _RopeModule in CMakeLists.txt to match Package.swift by @iCharlesHu in #373
- Fix the incorrect file name in OrderedCollections cmake file by @iCharlesHu in #377
- [Deque]: Fix bogus assert in Deque._Storage._ensureUnique by @lorentey in #381
- [test] TreeDictionary.Keys: Remove stray print thatβs flooding test output by @lorentey in #370
- Rename _CollectionsUtilities to InternalCollectionsUtilities by @lorentey in #382
- [Rope] Fix copy-on-write violation in Rope.join by @lorentey in #384
- Add Single Module Build Mode to CMake for Foundation by @jmschonfeld in #385
Swift Collections 1.1.0
This feature release adds a number of new data structure implementations, along with minor changes to existing constructs.
New Data Structures
Heap
implements a min-max heap, backed by a native array. (Contributed by @AquaGeek)BitSet
andBitArray
are two alternate representations of a bitmap type, backed by dynamically allocated storage. (Contributed by @MahanazAtiqullah)TreeSet
andTreeDictionary
are hashed collections implementing Compressed Hash-Array Mapped Prefix Trees (CHAMP). They provide similar API asSet
/Dictionary
in the Standard Library, but as persistent data structures, supporting incremental mutations of shared instances and efficient structural diffing. (Contributed by @msteindorfer)
Other Changes
- This version of the package can only be built using Swift 5.7.2 or later.
- New methods: the
OrderedSet.isEqualSet
family of functions provide a way to test that two containers contain the same members, ignoring the order of elements. (#183, #234) - New method:
OrderedSet.filter
implements a version of the standard filter operation that returns anOrderedSet
instead of anArray
. (#159) debugDescription
implementations have been updated to follow Swift best practice. (These are called by container types likeArray
to print their elements, so they work best when they're succinct variants ofdescription
that are suitable for embedding in structured output: specifically, they must not produce unpaired delimiter characters ([
/]
,(
/)
,{
/}
,<
/>
etc), raw top level commas, semicolons, colons, unquoted strings etc.debugDescription
should not needlessly print type names etc.)
New Contributors
- @AquaGeek made their first contribution in #61
- @ejmarchant made their first contribution in #82
- @just-gull made their first contribution in #115
- @jPaolantonio made their first contribution in #121
- @MahanazAtiqullah made their first contribution in #83
- @hectormatos2011 made their first contribution in #155
- @ktoso made their first contribution in #159
- @CTMacUser made their first contribution in #116
- @hassila made their first contribution in #297
Many thanks to our contributors for their great work (and patience)!
List of Pull Requests
Full Changelog: 1.0.6...1.1.0
- Add a min-max heap implementation that can be used to back a priority queue by @AquaGeek in #61
- [benchmark] Review and extend Heap benchmarks by @lorentey in #76
- Add reference benchmarks for bit vector implementations by @lorentey in #79
- Fix Markdown link in README by @AquaGeek in #77
- Fix documentation for types conforming to ExpressibleByArrayLiteral o⦠by @ejmarchant in #82
- [Heap] Performance tweaks by @lorentey in #78
- Fix typos: missing subscript parameters by @ejmarchant in #81
- [Heap] Update implementation details section in docs by @lorentey in #84
- Update CMakeLists.txt by @compnerd in #85
- Stop depending on swift-collections-benchmark by @lorentey in #86
- [OrderedDictionary] modifyValue β updateValue by @lorentey in #91
- Add Benchmarks package to workspace by @lorentey in #93
- [OrderedDictionary] Deprecate
subscript(offset:)
for now by @lorentey in #92 - Documentation: Remove in-place mutation comments by @ejmarchant in #96
- [main] Freeze some types for consistency with their inlinable initializers by @lorentey in #98
- Follow stdlib's leading underscore rule by @ejmarchant in #95
- [Heap] Disable heap tests in release builds by @lorentey in #100
- [NFC] Merge release/1.0 to main by @lorentey in #105
- Merge
release/1.0
intomain
by @lorentey in #108 - [README] Note that
Heap
hasn't been tagged yet & list other enhancements in progress by @lorentey in #109 - PriorityQueueModule: remove
import Foundation
by @compnerd in #118 - [Heap] Remove Heap's
ascending
anddescending
views by @lorentey in #119 - [Heap] Enable heap tests in optimized builds (#101) by @just-gull in #115
- Update CMakeLists.txt by @compnerd in #122
- Fix link to package internal documentation by @jPaolantonio in #121
- Merge release/1.0 to main by @lorentey in #130
- BitArray and BitSet data structures by @MahanazAtiqullah in #83
- Sorted collections by @vihanb in #65
- Merge
release/1.0
tomain
by @lorentey in #141 - Remove Swift PM Artifacts to avoid Generated Schemes in Xcode by @hectormatos2011 in #155
- Reinstate custom schemes under Utils/swift-collections.xcworkspace by @lorentey in #156
- +OrderedSet add filter #158 by @ktoso in #159
- [Xcode] Update schemes & file template by @lorentey in #161
- [OrderedCollection] Use standard temp allocation facility, if available by @lorentey in #160
- [OrderedSet] Work around weird name lookup issue in compiler by @lorentey in #162
- =OrderedSet.filter Attempt to optimize filter impl by @ktoso in #163
- Force-inline _modify accessors to work around a performance issue by @lorentey in #165
- Merge release/1.0 branch to main by @lorentey in #172
- Incubate persistent data structures by @msteindorfer in #31
- Persistent collections updates by @lorentey in #174
- Persistent collections updates by @lorentey in #175
- Persistent collections updates (part 3) by @lorentey in #176
- Persistent collections updates (part 4) by @lorentey in #177
- [OrderedDictionary] Tiny documentation fix by @lorentey in #178
- Persistent collections updates (part 5) by @lorentey in #179
- Integrate PriorityQueueModule, BitCollections, PersistentCollections, SortedCollections into release/1.1 by @lorentey in #181
- Persistent collections updates (part 6) by @lorentey in #180
- Persistent collections updates (part 7) by @lorentey in #182
- [BitSet] Fix decoding format on 32 bit architectures by @lorentey in #185
- Persistent collections updates (part 8) by @lorentey in #184
- Persistent collections updates (part 9) by @lorentey in #188
- Add Sendable conformances to all public types by @lorentey in #191
- [test] Check baseline API expectations for set-like types by @lorentey in #192
- Fleshing out
PersistentSet
by @lorentey in #193 - Rename
PriorityQueueModule
toHeapModule
by @lorentey in #194 - [BitSet] Fix invariant violation in member subscript by @lorentey in #195
- [1.1.0] Bump minimum required Swift toolchain to 5.5 by @lorentey in #196
- Restore support for building with Swift 5.5 by @lorentey in #198
- Merge release/1.0 to release/1.1 by @lorentey in #199
- Update CMake configuration in preparation for 1.1 by @lorentey in #200
- Update CMakeLists.txt ...