Karoy Lorentey
f79fd630bf
[PersistentCollections] _Node.isDisjoint: Add new fast path
2022-09-22 16:33:55 -07:00
Karoy Lorentey and Michael Steindorfer
f2539a4b21
Update Sources/PersistentCollections/Node/_Stack.swift
...
Co-authored-by: Michael Steindorfer <michael@steindorfer.name >
2022-09-22 16:31:21 -07:00
Karoy Lorentey and Michael Steindorfer
24619dfe31
Update Sources/PersistentCollections/Node/_Node+isDisjoint.swift
...
Co-authored-by: Michael Steindorfer <michael@steindorfer.name >
2022-09-22 11:31:11 -07:00
Karoy Lorentey
958fd47539
[PersistentSet] Start drafting the new type
2022-09-21 10:45:20 -07:00
Karoy Lorentey
04b134e9aa
[PersistentCollections] Fix memory management for the hash tree iterator
...
This slows iteration down by about 37% percent but it now works within ManagedBuffer’s requirements.
2022-09-21 10:45:20 -07:00
Karoy Lorentey
c355812e53
[PersistentDictionary] Small cleanups
2022-09-21 10:45:20 -07:00
Károly Lőrentey
e19ba8e787
[Utilities] Adjust Swift 5.7 version check
2022-09-21 10:45:20 -07:00
Karoy Lorentey
acf081966f
Merge pull request #180 from lorentey/PersistentCollections-updates
2022-09-20 12:04:14 -07:00
Karoy Lorentey and Michael Steindorfer
39fc818e0e
Update Sources/PersistentCollections/PersistentDictionary/PersistentDictionary+Values.swift
...
Co-authored-by: Michael Steindorfer <michael@steindorfer.name >
2022-09-20 12:03:03 -07:00
Karoy Lorentey and Michael Steindorfer
a28921bb81
Update Sources/PersistentCollections/PersistentDictionary/PersistentDictionary+Keys.swift
...
Co-authored-by: Michael Steindorfer <michael@steindorfer.name >
2022-09-20 12:02:45 -07:00
Karoy Lorentey
8d7c777e47
[PersistentCollections] _children → children, itemEnd → itemsEndSlot, childEnd → childrenEndSlot
2022-09-19 21:25:07 -07:00
Karoy Lorentey
b7bfc52664
[test] Add Dictionary API checker protocol
...
This can be used to verify that a new dictionary implementation
provides all expected members.
2022-09-19 21:25:07 -07:00
Karoy Lorentey
71c881cfdb
[PersistentDictionary] mapValues, compactMapValues, filter
2022-09-19 21:25:07 -07:00
Karoy Lorentey
6dc8de17b0
[PersistentDictionary] Add more initializers
2022-09-19 21:25:07 -07:00
Karoy Lorentey
75edf6cd69
[PersistentDictionary] Add support for merging dictionaries & for in-place value mutations
2022-09-19 21:25:07 -07:00
Karoy Lorentey
ea30715a6c
[PersistentDictionary] Implement Keys and Values views
2022-09-19 21:25:07 -07:00
Karoy Lorentey
310f801deb
[Utilities] Add UInt16 rank utilities
2022-09-19 21:25:07 -07:00
Karoy Lorentey
a2491aac45
[PersistentDictionary] Improved copy & resize operations
...
Don’t copy the current node and then insert a new item into it.
Instead, create the copy with the new item already inserted.
Ditto for new collisions.
2022-09-19 21:25:07 -07:00
Karoy Lorentey
e11f923d98
[PersistentDictionary] Don’t bump version in uniqueKeys initializers
2022-09-19 21:25:07 -07:00
Karoy Lorentey
d9cff57f0c
[test][PersistentDictionary] Clean up fixture initialization
2022-09-19 21:25:07 -07:00
Karoy Lorentey
f7c419d7cf
[PersistentDictionary] Rework allocations
2022-09-19 21:25:07 -07:00
Karoy Lorentey
9da672fdf8
[PersistentDictionary] Fix index(forKey:) test
2022-09-19 21:25:07 -07:00
Karoy Lorentey
12e3867ccb
[Collections] Allow determining if internal checking is enabled
...
In the benchmark target, complain loudly if consistency checks
are enabled.
2022-09-19 21:25:07 -07:00
Karoy Lorentey
53895c6537
[PersistentCollections] Split up node mutations into multiple files
2022-09-19 21:24:37 -07:00
Karoy Lorentey
b3227e63ea
[PersistentCollections] New benchmarks measuring behavior on string data
2022-09-19 21:24:37 -07:00
Karoy Lorentey
7817d46e58
Merge pull request #181 from lorentey/integrate-the-world
...
Integrate PriorityQueueModule, BitCollections, PersistentCollections, SortedCollections into release/1.1
2022-09-19 21:19:06 -07:00
Karoy Lorentey
4c4154ca23
[SortedCollections] Just disable SortedDictionary tests for now
2022-09-19 21:10:36 -07:00
Karoy Lorentey
d2e82ada53
[tests] checkBidirectionalCollection: Don’t pointlessly repeat index(_:offsetBy:limitedBy:) probe
2022-09-19 17:27:22 -07:00
Karoy Lorentey
27626fa703
[Xcode] Clean up the schemes situation
2022-09-19 17:09:04 -07:00
Karoy Lorentey
9d113c8c6a
[Benchmarks] Update dependencies
2022-09-19 16:59:53 -07:00
Karoy Lorentey
b263fb442e
[Benchmarks] Move source files under Sources/
...
This eliminates the need to use path overrides.
Also, explicitly define a product for the “benchmark” executable.
2022-09-19 16:58:25 -07:00
Karoy Lorentey
f4dc3aa4a9
Merge branch 'feature/SortedCollections' into release/1.1
...
# Conflicts:
# Package.swift
# Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/SortedCollections.xcscheme
2022-09-19 16:06:24 -07:00
Karoy Lorentey
de31437ee5
Merge branch 'feature/PersistentCollections' into release/1.1
2022-09-19 16:02:51 -07:00
Karoy Lorentey
31eca4a02c
Merge branch 'feature/BitSet' into release/1.1
...
# Conflicts:
# Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme
2022-09-19 16:00:20 -07:00
Karoy Lorentey
7499bc29e8
Merge pull request #179 from lorentey/PersistentCollections-updates
...
Persistent collections updates (part 5)
2022-09-19 10:56:50 -07:00
Karoy Lorentey
d45f264ef0
[PersistentDictionary] Fix index(forKey:) performance
2022-09-17 20:04:19 -07:00
Karoy Lorentey
5240bf6e0a
[PersistentCollections] Reduce _Bucket’s storage size
2022-09-17 17:20:34 -07:00
Karoy Lorentey
2321b34d80
[PersistentCollections] Fix node sizing logic
...
Base the allocation request on the currently occupied space, not the
full capacity.
The original code tended to lead to unnecessary doubling of the node
size in each copy, until we exhaust the 32 bit capacity value. (Oops.)
2022-09-17 17:20:34 -07:00
Karoy Lorentey
57deed5f0f
[PersistentDictionary] Implement in-place mutations
...
# Conflicts:
# Tests/PersistentCollections2Tests/PersistentMap Fixtures.swift
2022-09-17 17:20:34 -07:00
Karoy Lorentey
3b7d241e15
[PersistentDictionary] Add some docs
2022-09-16 23:19:40 -07:00
Karoy Lorentey
1661bd431c
[PersistentDictionary] Implement in-place mutations for defaulted subscript
2022-09-16 23:19:40 -07:00
Karoy Lorentey
418378107c
Merge pull request #178 from lorentey/tiny-doc-fix
...
[OrderedDictionary] Tiny documentation fix
2022-09-16 21:12:58 -07:00
Karoy Lorentey
9f38e7424b
[OrderedDictionary] Doc fix
2022-09-16 16:07:33 -07:00
Karoy Lorentey
1324c4e863
[OrderedDictionary] Implement index invalidation
2022-09-16 16:03:45 -07:00
Karoy Lorentey
6cf128e6ea
[PersistentCollections] Internal doc updates
2022-09-16 14:49:37 -07:00
Karoy Lorentey
52e3ea6ca9
[test] LifetimeTracked: Implement high-fidelity hash forwarding
...
`RawCollider` doesn’t like to get called through the high-level
hashing APIs.
2022-09-16 01:31:15 -07:00
Karoy Lorentey
0fe7f080c0
[PersistentCollections] offset → slot
...
(Internally) standardize on using the word “slot” to refer to an id
for a location within a contiguous storage buffer that can hold a
single item of some kind.
“Offset” is sometimes used in public APIs (to refer to integer
distances within collections, relative to some start position),
and using the same term here causes internal naming difficulties.
A “bucket” is therefore a more specific name for a slot within a
hash table.
2022-09-16 01:30:06 -07:00
Karoy Lorentey
bf3617e379
[PersistentCollections] Work on testing a bit; add fixtures
...
The new fixtures provide an easier way to construct sample
hash trees with specific structure, to run tests on them.
Fixtures are able to determine the expected ordering for each
sample tree, which comes super useful for verifying collection
conformances.
2022-09-15 20:56:50 -07:00
Karoy Lorentey
16393ea2c8
[PersistentCollections] Allow dumping hash trees in iteration order
2022-09-15 20:56:50 -07:00
Karoy Lorentey
02133f1262
[PersistentCollections] Implement path-based indices
...
The Index type now represents a path into the tree,
consisting of a series of child offsets from the root node,
as well as the item offset within the final node.
(This all fits in a couple of words, as the depth of the tree
is fixed, and the offset path can always be compressed into a
single `UInt` value.)
To speed up basic operations, we also cache the final node
as an unsafe-unowned reference. Dereferencing this is extremely
unsafe, so the Index type carries an unsafe reference to the root
node along with a mutation counter, to allow reliable(*) index
validation. If index’s stored root is identical to the root of the
collection, and they have the same version value, then we can assume
that the index is still valid.
2022-09-15 20:56:50 -07:00