Commit Graph
239 Commits
Author SHA1 Message Date
Karoy Lorentey 7d6d779377 [PersistentCollections] Convert global lets to computed properties
This is just to prevent these from getting turned into global variables that are initialized on first access, especially once we make things inlinable.
(I expect these will all get moved under some type eventually.)
2022-09-09 00:47:10 -07:00
Karoy Lorentey 8d96e3d847 [PersistentCollections] DataBufferElement → Element, ReturnPayload → Element
`Payload` wouldn’t be a bad term for this, though, and we may return to it when we start thinking about PersistentSet.
2022-09-09 00:47:10 -07:00
Karoy Lorentey 36c7f9270c [PersistentCollections] TrieBufferElement → _Node 2022-09-09 00:47:10 -07:00
Karoy Lorentey 5d8bb68209 [PersistentCollections] ReturnBitmapIndexedNode → _Node/Self 2022-09-09 00:47:10 -07:00
Karoy Lorentey 750559ea9e [PersistentDictionary] PersistentDictionaryIndex → PersistentDictionary.Index 2022-09-08 00:55:48 -07:00
Karoy Lorentey 6f93a628e8 [PersistentDictionary] BitmapIndexedDictionaryNode → PersistentDictionary._ Node, Header → _NodeHeader
Also move Capacity, Bitmap under _NodeHeader.

Start thematically organizing _Node members.
2022-09-07 21:06:19 -07:00
Karoy Lorentey 2597ff23cd [PersistentDictionary] Apply leading underscore rule to common functions 2022-09-07 21:06:19 -07:00
Karoy Lorentey 1f7eb2f95d [PersistentDictionary] Remove unused utility functions 2022-09-07 21:06:19 -07:00
Karoy Lorentey 978a833756 [PersistentDictionary] Clean up Iterator types
- DictionaryKeyValueTupleIterator → PersistentDictionary.Iterator
- DictionaryKeyValueTupleReverseIterator → PersistentDictionary.ReverseIterator

The latter type is unused. Moved under the Unused folder for now.
2022-09-07 21:06:19 -07:00
Karoy Lorentey 8e19b80a23 [PersistentCollections] Apply the leading underscore rule
Also, move types into their own files.
2022-09-07 21:06:19 -07:00
Karoy Lorentey b2d6d98edb [PersistentCollections] NonzeroBits → _NonzeroBits
This doesn’t need to be public API.
2022-09-07 19:38:55 -07:00
Karoy Lorentey 1a4993dfda [PersistentCollections] Reformat
Follow the Standard Library coding style:

- Hard 80 character line limit
- Use two spaces as the indentation unit
- Overlong lines broken up by adding line breaks at the following places
    1. After opening delimiters & before closing delimiters
    2. Between each item in a list
    3. Extracting subexpressions etc as needed
2022-09-07 19:16:41 -07:00
Karoy Lorentey de5fad7477 Merge pull request #31 from msteindorfer/capsule-collections
Incubate persistent data structures
2022-09-07 09:18:23 -07:00
Michael Steindorfer ccd11e55dd [Capsule] Clean-up annotations 2022-09-06 21:20:41 +02:00
Michael Steindorfer e2f53441d6 [Capsule] Add subscript(position:) benchmarks 2022-09-06 20:39:38 +02:00
Michael Steindorfer 868eb2fdcc [Capsule] Remove comment after check 2022-09-06 16:43:19 +02:00
Michael Steindorfer 49283d3251 [Capsule] Remove unchecked variant of initializer 2022-09-06 16:37:23 +02:00
Michael Steindorfer 26b97f95d2 [Capsule] Unify insertion/deletion methods
Note, always tracking discardable result negatively impacts batch
use cases.
2022-09-06 16:11:17 +02:00
Michael Steindorfer 7ea47d711f [Capsule] Simplify deletion methods 2022-09-06 14:02:54 +02:00
Michael Steindorfer 4e213be00a [Capsule] Simplify insertion methods 2022-09-06 13:53:58 +02:00
Michael Steindorfer 5bc17ffe84 [Capsule] Rename package to PersistentCollections 2022-09-06 13:22:10 +02:00
Michael Steindorfer 6b905eb928 [Capsule] Implement BitmapIndexedDictionaryNode: CustomStringConvertible 2022-09-06 10:01:25 +02:00
Michael Steindorfer a4bce51f58 [Capsule] Fix TODO comment 2022-09-06 09:43:21 +02:00
Michael Steindorfer 870e49d67a [Capsule] Remove not necessary type alias 2022-09-05 21:25:03 +02:00
Michael Steindorfer e9dec67cc2 [Capsule] Rename base iterators 2022-09-05 21:21:22 +02:00
Michael Steindorfer 45b9d8db26 [Capsule] Use non-materializing data/trie slice views in iterator 2022-09-05 21:11:20 +02:00
Michael Steindorfer bf224619a5 [Capsule][WIP] Return to monomorphic spine, continued 2022-09-05 20:24:13 +02:00
Michael Steindorfer 81a38b39ca [Capsule] Add BitmapIndexedDictionaryNode: CustomStringConvertible skeleton 2022-09-05 12:17:18 +02:00
Michael Steindorfer 0550c27fca [Capsule] Add BitmapIndexedDictionaryNode: CustomDebugStringConvertible skeleton 2022-09-05 12:15:09 +02:00
Karoy Lorentey 9a9d7d87d8 Merge branch 'release/1.0'
# Conflicts:
#	.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/Collections.xcscheme
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/OrderedCollections.xcscheme
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/swift-collections-Package.xcscheme
2022-09-02 15:30:31 -07:00
Michael Steindorfer 26893b1712 [Capsule][WIP] Return to monomorphic spine 2022-09-02 12:19:26 +02:00
Michael Steindorfer 5eb679dff7 [Capsule] Reduce expensive invariant check that slow down testing 2022-09-02 10:13:57 +02:00
Michael Steindorfer 3d4b802ef7 [Capsule] Add specialized subscript(position: Self.Index) method 2022-09-02 09:01:42 +02:00
Michael Steindorfer cc0f051b74 [Capsule] Revert to AnyObject node representation
Fixes an issue with `isTrieNodeKnownUniquelyReferenced` and existential
types.
2022-09-02 09:01:42 +02:00
Michael Steindorfer fa8afba05a [Capsule] Convert to TrieNode content and add specialized index
Note that this is an intermediate step towards generic heterogeneous
`any` type content.
2022-09-02 09:01:42 +02:00
Michael Steindorfer b879788d8a [Capsule] Replace sizePredicate usage by count 2022-09-02 09:01:42 +02:00
Michael Steindorfer c6b971910f [Capsule] Replace top-level cachedSize with per node count 2022-09-02 09:01:42 +02:00
Michael Steindorfer c8a880794d [Capsule] Simplify initializers 2022-09-02 09:01:42 +02:00
Michael Steindorfer 3b2c061ecf [Capsule] Backout explicit collision bitmap to simplify codebase 2022-09-02 09:01:42 +02:00
Karoy Lorentey a9e2276472 Merge pull request #168 from lorentey/cherry-pick-1.0.3
Cherry pick recent fixes to release/1.0 in preparation of tagging 1.0.3
2022-09-01 17:21:25 -07:00
Karoy Lorentey 71aa4a39ae [OrderedDictionary] Resolve spurious(?) call-site ambiguities 2022-08-31 17:57:24 -07:00
Karoy Lorentey b379fa7aee [OrderedCollections] Force-inline all _modify accessors
(cherry picked from commit ee1b2de06e)
2022-08-31 17:13:53 -07:00
Karoy Lorentey 87c78de6b4 [Deque] Force-inline the subscript’s _modify accessor to work around a performance issue
Resolves #164.

(cherry picked from commit 98cd753866)
2022-08-31 17:13:53 -07:00
Karoy Lorentey 6cbecdb467 [OrderedSet] Work around weird name lookup issue in compiler
Resolves #157.

(cherry picked from commit 1071b37294)
2022-08-31 17:13:53 -07:00
Karoy Lorentey d0f05d5cf5 [OrderedCollection] Use standard temp allocation facility, if available
The 5.6 stdlib introduced a new facility for temporary allocations
that promises better performance than direct allocations. Use it when
the toolchain version is above 5.6.

(cherry picked from commit ddb6d141b3)
2022-08-31 17:13:53 -07:00
Karoy Lorentey ee1b2de06e [OrderedCollections] Force-inline all _modify accessors 2022-08-31 15:31:42 -07:00
Karoy Lorentey 98cd753866 [Deque] Force-inline the subscript’s _modify accessor to work around a performance issue
Resolves #164.
2022-08-31 13:53:52 -07:00
Michael Steindorfer 810f22d976 [Capsule] Add sequence representations for slices 2022-08-19 14:30:48 +02:00
Karoy Lorentey c3fdcf746e Merge pull request #163 from ktoso/wip-filter-set
=OrderedSet.filter Attempt to optimize filter impl
2022-08-18 10:52:29 -07:00
Karoy Lorentey 3bf91b1ee4 Remove hash lookups while filtering 2022-08-17 22:57:37 -07:00