Commit Graph
36 Commits
Author SHA1 Message Date
Karoy Lorentey 48ac82c029 [Deque] Modernize code base for Swift 5.5 2022-10-09 20:11:51 -07:00
Karoy Lorentey c7c0a094f9 Update Xcode schemes 2022-10-09 15:44:56 -07:00
Karoy Lorentey 7d6fe857da [Benchmark] Add Xcode scheme for memory benchmark target 2022-09-27 14:18:39 -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 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 c9ca59fbb9 [PersistentCollections] Improved storage representation
- Switch to using `ManagedBuffer` to represent node storage. This has
  useful performance benefits, but it significantly complicates access
  to node data. We no longer have direct access to the underlying raw
  storage: everything needs to go through closures passed to
  `ManagedBuffer.withUnsafeMutablePointers`.

- Introduce `struct _Node` and `struct _Node.UnsafeHandle` to
  represent a (strong) reference to a hash tree node, and a
  convenient handle for node storage, respectively. Use these instead
  of directly accessing the ManagedBuffer object, whenever feasible.

- Implement separate paths for in-place mutations vs copy-on-write
  operation, optimizing both flavors.

- Go to great lengths to eliminate unnecessary retain-release traffic,
  whenever possible.

- Push subtree counts into parent nodes by moving the corresponding
  field from the node header into the `_Node` struct. (This results in
  a cool ~20x speedup for jumping around in the tree by integer
  offsets.)

- Implement a type-punned empty root singleton, to allow creating
  empty trees without allocating anything.
2022-09-13 23:48:54 -07:00
Karoy Lorentey 14f90620c8 [PersistentCollections] Introduce _Bucket, _Bitmap, _HashPath, and _HashValue
These provide nicer tools for slicing up hash values and dealing with node bitmaps.

_Bucket is a logical entry in the hash table inside a node.
_Bitmap is a set of bucket values, represented by a bitset.
_HashPath facilitates slicing up a hash value into a series of bucket values.
_HashValue represents a hash value.

This is still just mostly superficial refactoring, with little to no functional changes.
2022-09-09 00:47:10 -07:00
Karoy Lorentey 9b0aa87146 [PersistentCollections] Add Xcode scheme 2022-09-07 17:35:33 -07: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
Karoy Lorentey d5bd858758 [Deque] Fix testing in DequeModule.xcscheme
(cherry picked from commit 0a26362226)
2022-08-31 17:13:53 -07:00
Karoy Lorentey ac20a2c31d [Xcode] Update schemes & file template
Update Collections scheme with support for testing.
Update the copyright year in file template.

(cherry picked from commit 3437abecc4)
2022-08-31 17:13:53 -07:00
Karoy Lorentey 4908474e30 Fixup schemes 2022-08-31 17:06:34 -07:00
Karoy Lorentey b816872d24 swift-collections.xcworkspace: Update dependencies
(cherry picked from commit 00a99aa77c)
2022-08-31 17:03:08 -07:00
Karoy Lorentey 8611b32dfe Set up shared schemes in the xcworkspace under Utils/
(cherry picked from commit 3fce10a45a)
2022-08-31 17:03:03 -07:00
Karoy Lorentey 0a26362226 [Deque] Fix testing in DequeModule.xcscheme 2022-08-31 13:54:43 -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 04a23fe815 [workspace] Add scheme for BitCollections 2022-08-25 19:58:13 -07:00
Karoy Lorentey 3437abecc4 [Xcode] Update schemes & file template
Update Collections scheme with support for testing.
Update the copyright year in file template.
2022-08-17 13:56:03 -07:00
Karoy Lorentey cbf933665b [BitSet] Revert to non-generic BitSet
Also, remove members that were generic over FixedWidthInteger.
2022-08-12 19:22:24 -07:00
Karoy Lorentey d8bace07c8 Merge branch 'main' into feature/BitSet
# Conflicts:
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/BitCollections.xcscheme
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/CollectionsTestSupport.xcscheme
#	Utils/swift-collections.xcworkspace/xcshareddata/xcschemes/PriorityQueueModule.xcscheme
2022-08-12 16:38:36 -07:00
Karoy Lorentey 00a99aa77c swift-collections.xcworkspace: Update dependencies 2022-08-03 12:18:57 -07:00
Karoy Lorentey 3fce10a45a Set up shared schemes in the xcworkspace under Utils/ 2022-08-03 12:18:57 -07:00
Károly Lőrentey 1d1fbc82d4 [BitSet] Make BitSet generic over its Element
This gets rid of the weird asymmetry between reading the contents of a BitSet (where we used to always get Int values) and mutating it (where we used to be able to give it values fo any fixed-width integer type).
2022-07-30 23:25:53 -07:00
Karoy Lorentey c8d81c0a45 Update dependencies in dev workspace 2022-06-20 12:54:53 -07:00
Karoy Lorentey 9dde4b5603 [Utils] run-full-tests.sh: Add support for testing on Swift 5.3 without manual editing 2021-11-15 15:46:12 -08:00
Károly Lőrentey ddc8b9c66d [Utils] run-full-tests.sh: Keep going after a failure 2021-11-15 14:08:09 -08:00
Karoy Lorentey 103008aca4 [run-full-tests.sh] Fix bashism: == vs = 2021-09-10 13:57:23 -07:00
Karoy Lorentey 8303a77bc2 [Utils] run-full-tests.sh: Add disclaimer about needing to tweak the script sometimes 2021-09-07 14:51:02 -07:00
Karoy Lorentey 6fbf995006 [Utils] Add run-full-tests.sh script
This script builds and tests the package a tiny fraction of the full support matrix. It's useful for prerelease testing.
2021-09-03 15:58:19 -07:00
Karoy Lorentey 01f1104841 Move development .xcworkspace under Utils/
This (undocumented) workspace allows benchmark developers to work on the collection benchmarks and the benchmarking infrastructure within Xcode, with minimal pain. Moving it under Utils/ makes it easier to build the package with the xcodebuild utility; it also makes it (hopefully) clear that the workspace isn't source stable.
2021-09-03 14:20:20 -07:00
Karoy Lorentey 6b86e2cf4a Stop depending on swift-collections-benchmark (#86)
* Stop depending on swift-collections-benchmark

Instead, move the benchmark suite into its own private nested package, under `Benchmarks/`.

The recommended way to build & run benchmarks is via the `Utils/run-benchmarks.sh` script, which continues to work as before with this change.

* Delete top-level Package.resolved file
# Conflicts:
#	.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-benchmark.xcscheme
#	Package.swift
2021-08-19 19:26:41 -07:00
Karoy Lorentey fa45de1018 Work around another MergeModules crash (#62)
* [utils] Add utility for shuffling sources to help reproduce MergeModules issues

* [Deque] Collapse Sequence/Collection conformances into a single file

The MergeModules phase in the compiler is broken: it isn’t always able to correctly handle circular dependencies across source files, like the ones that keep organically popping up with Sequence/Collection conformances that are defined in separate files.

Such dependencies sometimes triggers a compiler crash, depending on some (unknown) environmental parameters.

Trying to manually find and eliminate these circular dependencies has not proved productive. Instead, roll all Collection conformances into a single, huge source file.

* [Deque] Update CMakeLists
2021-07-08 17:02:00 -07:00
Karoy Lorentey a2bcac435f Initial import.
Introduce OrderedCollections module
2021-04-05 09:41:00 -07:00