18 Commits
Author SHA1 Message Date
Karoy Lorentey 35d5746117 Rename _CollectionsUtilities to InternalCollectionsUtilities
We are forced to do this due to an Xcode issue (#364) with underscored module names.

This module remains unstable, despite the removal of the underscore. Directly importing it from outside the package remains unsupported. This module and/or its entire contents may go away or change in incompatible ways in any future swift-collections release.
2024-05-29 14:00:13 -07:00
Karoy Lorentey 3bc1c3be46 [BitCollections] Update copyright dates 2024-01-30 18:09:37 -08:00
Karoy Lorentey db3bd17b40 [BitCollections] Adopt some instead of classic generic where possible 2024-01-30 18:07:00 -08:00
Karoy Lorentey 3cbf81976d Merge pull request #266 from lorentey/monomodule-support
Monomodule support
2023-03-23 13:54:45 -07:00
Karoy Lorentey e6ecdac581 Fix off by one error in BitSet 2023-03-22 21:45:46 -07:00
Karoy Lorentey cbab9e3737 Introduce COLLECTIONS_SINGLE_MODULE condition 2023-03-21 18:42:33 -07:00
Karoy Lorentey a2f4b18ae0 [BitSet, OrderedCollections] Unify UnsafeBitSet implementations 2022-11-28 16:30:55 -08:00
Karoy Lorentey 51a1554f89 Introduce _UniqueCollection & _SortedCollection
These marker-like protocols will allow certain
generic operations to get a performance boost
if the passed-in value happens to be guaranteed
to contain unique elements or to be sorted.

Also, review API checker protocols for Sets and
sorted collections and adjust things as needed.

BitSet gains custom implementations for min()
and max() as part of these improvements.
2022-10-19 01:40:06 -07:00
Karoy Lorentey 1b71d2cd94 [BitSet] Fix invariant violation in member subscript 2022-10-09 16:12:17 -07:00
Karoy Lorentey 78ac2eaed7 [BitSet] Add remove(at:) implementation 2022-10-09 13:20:12 -07:00
Karoy Lorentey 19c9f282c9 Delete _FastMembershipCheckable
We don’t actually need this, as `_customContainsEquatableElement`
returning non-nil is a perfectly suitable indication that containment
checking is fast.
2022-09-29 17:37:48 -07:00
Karoy Lorentey 3d10964905 [PersistentSet] Flesh out isSubset/iSuperset/isDisjoint/etc overloads (untested)
This adds an experimental _FastMembershipCheckable protocol to speed
up these relationship predicates when possible — having separate
overloads for each known collection with a fast containment check
is not going to scale for long.

This commit also introduces a set of isEqual(to:) methods that
generalize ==.
2022-09-24 17:02:16 -07:00
Károly Lőrentey 41fe772f88 [BitSet] More doc fixes 🤦🏼‍♂️ 2022-09-04 19:27:51 -07:00
Karoy Lorentey 4dfcc4f9ef [BitSet] Doc fixes 2022-08-31 13:14:45 -07:00
Karoy Lorentey 464d973bf3 [BitSet] Remove precalculated count. Add BitSet.Counted wrapper for use cases that require it.
This results in a significant speedup for both individual
insert/remove operations as well as bulk set operations -
up to 4x.

Use cases that require an O(1) count can use the separate
BitSet.Counted type.
2022-08-31 13:04:51 -07:00
Karoy Lorentey e34bbb8c4c [BitSet] Add reserveCapacity.
This works slightly different as usual, as the input argument
specifies the maximum value we expect to store, not the maximum
count.
2022-08-29 22:40:59 -07:00
Karoy Lorentey c02557f717 [BitSet] Add member subscripts 2022-08-28 16:33:50 -07:00
Karoy Lorentey da84296b9b [BitSet] Add custom sorted(), returning self 2022-08-16 15:53:06 -07:00