Commit Graph
47 Commits
Author SHA1 Message Date
Karoy Lorentey 33b759b842 [Heap] PriorityQueueModule → HeapModule 2022-10-09 15:44:44 -07:00
Karoy Lorentey 92d1d1297e [PersistentDictionary] Add a quick&dirty memory benchmark
The new executable target `memory-benchmark` collects some memory usage statistics and outputs average memory efficiency for a range of sizes in CSV format.

Bump required toolchain version for benchmarks to Swift 5.5.
2022-09-23 16:47:30 -07:00
Karoy Lorentey 9407eff8ca [PersistentDictionary] Add index striding benchmark 2022-09-23 11:15:46 -07:00
Karoy Lorentey 94d979c523 [Benchmarks] Fix header name in #include 2022-09-23 11:15:26 -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 b3227e63ea [PersistentCollections] New benchmarks measuring behavior on string data 2022-09-19 21:24:37 -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 1a87233bcd [PersistentCollections] Review & update benchmarks 2022-09-07 17:35:59 -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 e2f53441d6 [Capsule] Add subscript(position:) benchmarks 2022-09-06 20:39:38 +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 5bc17ffe84 [Capsule] Rename package to PersistentCollections 2022-09-06 13:22:10 +02:00
Michael Steindorfer f6fe3c0658 [Capsule] Add init(uncheckedUniqueKeysWithValues:) benchmark
Further add missing items to the benchmark library.
2022-09-06 09:38:36 +02:00
Michael Steindorfer 8bc5e20b29 [Capsule] Enable Keys and Values view benchmarks 2022-09-05 20:53:41 +02:00
Michael Steindorfer afcd915044 [Capsule] Add persistent dictionary index benchmarks 2022-09-02 09:00:52 +02:00
Karoy Lorentey c82261a529 [Deque] Add direct benchmarks for indexing subscript’s _modify accessor 2022-08-31 14:59:50 -07:00
Karoy Lorentey ec69910d8d [BitSet] Review / clean up benchmarks 2022-08-29 22:41:11 -07:00
Karoy Lorentey b9d91f4a9a Remove benchmarking data 2022-08-17 22:58:37 -07:00
Karoy Lorentey 3bf91b1ee4 Remove hash lookups while filtering 2022-08-17 22:57:37 -07:00
Konrad `ktoso` Malawski f56388e4f7 =OrderedSet.filter Attempt to optimize filter impl 2022-08-18 10:28:20 +09:00
Michael Steindorfer 92d07b3910 [Capsule] Add [COW] subscript, remove existing benchmark 2022-08-09 17:20:29 +02:00
Michael Steindorfer fc60fae4d7 [Capsule] Rename HashMap to PersistentDictionary 2022-08-09 17:20:28 +02:00
Michael Steindorfer f956009ac2 [Capsule] Add [COW] subscript, insert benchmark 2022-08-09 17:20:28 +02:00
Michael Steindorfer 5fad00e87b [Capsule] Remove reserveCapacity test since it is not supported 2022-08-09 17:20:28 +02:00
Michael Steindorfer 0f0c0bdc90 [Capsule] Pin type to Capsule hash-map 2022-08-09 17:20:28 +02:00
Michael Steindorfer 1ffd819a0e [Capsule] Draft benchmark configuration 2022-08-09 17:20:28 +02:00
Michael Steindorfer e28f675e3f [Capsule] Copy DictionaryBenchmark and add some Dictionary API 2022-08-09 17:20:28 +02:00
Karoy Lorentey 55f3b58437 [benchmark] Update bit collections module name 2022-06-20 12:55:12 -07:00
Károly Lőrentey 8df65118eb Merge branch 'main' into feature/SortedCollections
# Conflicts:
#	.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme
#	.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-benchmark.xcscheme
#	Benchmarks/Benchmarks/CppBenchmarks.swift
2021-11-22 15:17:41 -08:00
Károly Lőrentey 49a82fe6e1 Merge branch 'main' into feature/BitSet
# Conflicts:
#	.gitignore
#	.swiftpm/xcode/xcshareddata/xcschemes/swift-collections-Package.xcscheme
#	Benchmarks/Package.resolved
#	Benchmarks/benchmark-tool/main.swift
#	Package.swift
#	Sources/CMakeLists.txt
#	Sources/Collections/CMakeLists.txt
#	Sources/Collections/Collections.swift
#	Sources/DequeModule/Deque+Collection.swift
#	Sources/OrderedCollections/CMakeLists.txt
#	Tests/CollectionsTestSupportTests/MinimalTypeConformances.swift
#	cmake/modules/SwiftSupport.cmake
2021-11-22 14:57:40 -08:00
173d2acc24 BitArray and BitSet data structures (#83)
* Create Screen Shot 2021-05-17 at 7.15.09 PM.png

* Delete Screen Shot 2021-05-17 at 7.15.09 PM.png

* Create BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Added BitArray as a product to the package

* Update Package.swift

* Update Package.swift

* Update Package.swift

* Update BitArray.swift

* Update Package.swift

* Update Collections.swift

* Update Collections.swift

* Update Package.swift

* Create BitArray.xcscheme

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* build: add a CMake based build system (#42)

Add a CMake based build system to enable bootstrapping the toolchain
with the ability to use Swift Collections in SPM.

* Update BitArray.swift

* Update BitArray.swift

* git: ignore vim swap files (#41)

* Initial conformation to Collection. Lots of faulty code right now

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* Update BitArray.swift

* [Deque] Work around stdlib issue with Array.withContiguousStorageIfAvailable (#44)

Resolves #27.

* [manifest] Ignore CMake files (#47)

The package manager doesn’t like it when it finds unexpected non-source files in source directories.

* [meta] Update dependencies (#48)

(This only affects local development.)

* [Deque][NFC] Remove unused code (#49)

* Changes to support OpenBSD. (#52)

* [cmake] Support amd64 architecture name.

On OpenBSD, "x86_64" is called "amd64", and therefore recognition of this
name is required for the cmake build.

* [cmake] Add missing file.

This is required since, for example, `Deque+Extras` requires
`_withContiguousStorageIfAvailable_SR14663`.

* ManagedBuffer.capacity is unavailable on OpenBSD.

ManagedBuffer requires nonstandard API to implement `capacity` and
subsequently is unavailable on OpenBSD. For portability, just use
`minimumCapacity` on this platform.

* Fixed subscript to have bit manipulations

* Update BitArray.swift

* Update BitArray.swift

* Moved Collection Conformance into appropriate file

* Implements some bit manip

* Fixed issue with endIndex resetting when storage element is full

When an element of the storage array in the BitArray filled, the endIndex would reset to 0, but then would be the correct value at any other time. This was due to a calculation error in endIndex

* Update invalid OrderedDictionary invariant check. (#53)

* Added XCTests, MutableCollection Conformance, Fixed endIndex bug

MutableCollection conformance still has bugs to be fixed
Additionally, the code is still very rough
endIndex had an issue where it was 0 when the array was empty. Fixed this by switching the code for count and endIndex, and making endIndex = 1 when count is 0

* Update BitArrayTests.swift

* Fixed subscript bug

Wouldn't work sometimes when current value was true because the return for `storage[index] & mask` could be anything >= 1, and not == 1, hence resulting in a unwanted toggle of the value. Fixed by comparing a boolean value of the current value to the boolean value of the newValue instead of the integers

* Code clean up ish

* Fixing a small typo on quick help documentation. (#55)

* Modifying Existing Code From Feedback

- `endIndex` corrected
- changed `remaining` in `count` to use ternary operator instead of being a computed local variable
- added `_split` as a helper function to `subscript`
- modified `set{...}` portion of `subscript` and included comments of the different options
- removed `clear()` as `removeAll()` seems to already exist somewhere
- modified unit tests to have a new BitArray for every test instead of a shared one
- Improved `testSubscriptSetOnly()` to hopefully be more thorough

* Added Bitwise Operations (No Tests)

Both mutable and immutable OR, AND, XOR operations

* Mark OrderedSetDiffingTests with availability (#54)

* Added Rough Bitwise Operation UnitTests

* Added BitSet Files

Did not add methods as I know a lot will go in BitStorage, which Im still figuring out

* Beginning implementations for BitSet

* Mutating Bitwise Operations

Performance-UNfriendly starter implementations

* Fixed subscript set mask for the &= operation and changed fatalErrors to preconditions

changed mask on &= operation from 0 to ~mask

* Also corrected subscript set test to fail if mask of 0 was used (instead of ~mask)

* Implemented BitSet with BitArray storage type and some tests

Tests are not yet passing. Pushing early so mentor can see progress
So sorry for waiting to push so late!

* Fixed error in first BitSet test ( which is testAppend() ) so it passes!

* BitSet formUnion initial implementation

* formUnion() test added and implementation modified to pass test

formUnion() is still incomplete and needs more tests atm

* Finished formUnion() for BitSet

* Modified formUnion() to use bit shifts instead

* Initial formIntersection function for BitSet

Untested

* Added an array view for BitSet, fixed BitSet.count bug, added and modified tests

* Initial Cartesian Product implementation and unfinished test

* Update BitArrayConformances.swift

* [CMake] swift-collections → SwiftCollections (#60)

* [CMake] swift-collections → SwiftCollections

This is an integration FIXME for SwiftPM: https://github.com/apple/swift-package-manager/pull/3595#issuecomment-875201764

* [CMake] Generate exports under cmake/modules/SwiftCollectionsConfig.cmake

* 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

* [test] checkCollection: Don’t pass decreasing indices to distance(from:to:) (#63)

Also, try running the conformance checkers on the minimal collection types to catch similar issues.

* Attempting to make an Index

* First steps in implementing Index struct for BitSet

* Fixed up endIndex

* Last tweaks of tonight

Tomorrow: fix up Index implementations, SetAlgebra, Unit Testing

* Adding index function preconditions

* Altered index(_ index: Index, offsetBy distance: Int) -> Index

* Update BitSetConformances.swift

* Update BitSetBitwiseOperations.swift

* Time for SetAlgebra!

* Transitioning to using CollectionsTestSupport

* Conformance to Set Algebra (without bringing in bitarray methods)

* Overloaded Bitwise Operators on BitArray

* Tilday (bitwiseNOT operations)

* Fixed coding style - 2 space indents

* Initial implementation od initializers

Bug found

* Fixed count bug

* Completed and XCTested BitArray initializers

By"XCTested" I mean using my own XCTests without the thorough CollectionsTestSupport

* Update BitArray.swift

* BitSet Initializers -- XCTested

By "XCTested" I mean not thoroughly tested with the CollectionsTestSupport methods

* BitSet's "custom" SetAlgebra

* contains(Int) and dropExcessFalses() methods for BitSet

* Consistently use UNIT.bitWidth instead of the number 8

This will be useful for benchmarking purposes

* Modified BitArray.swift according to feedback

Also added more typealias consistencies (using `UNIT.max` instead of hardcoded 255)

* Modified BitArray bitwise operations according to feedback

Added overloaded mutating operators

* Modified BitArrayConformances.swift according to feedback

* Modified BitArrayOperations.swift according to feedbacl

* Adjust Bitwise Operations' naming to be consistent with that of the atomics package

* .

* Modified According to Feedback

* testing

* First working test using CollectionsTestSupport

Testing sequence initializer

* All initializer tests for BitArray (except using BitSet)

* Update BitArrayTests.swift

* BitArray Append test

* Improved BitArray append() test to test multiple appends

* Untested remove functions

Also updated any UInt8 usages to use the UNIT typealias instead

* BitArray removeLast() Test

* Update BitArrayTests.swift

* BitArray removeAll() test

* BitArray removeLast(_ rangeSize: Int) function test and bug fix

* BitArray removet(at: Int) tests

Also added test for discardable results for current and existing remove tests

* BitArray removeFirst(_ rangeSize: Int) test implemented and passing

Current method has terrible run time for now as I can't get the optimized version to work yet

* BitArray first and last true index functions TEST and BUG FIX

firstTrueIndex()
lastTrueIndex()

* Failing OR and AND bitwise operations test on BitArray

* Update BitArrayTests.swift

* Update BitArrayTests.swift

* Update BitArrayTests.swift

* PUSHHHHH

* removeFirst(_ rangeSize: Int) optimization/bugFix

* BitArray bitwise operations tests and bug fixes

* BitSet tests, bug fixes, and name changes

sequence init test and bug fix
change "UNIT" to "WORD"

* Update BitArrayTests.swift

* add BitSet layout to test support

* BitSet testExpressibleByArrayLiteralAndArrayLiteralInit()

* testExpressibleByArrayLiteralAndArrayLiteralInit()

* BitSet insert and contains functions test + bug fixes

* forceInsert test for BitSet

* BitSet remove function test and improvements

* Update BitSetSetAlgebra.swift

* BitSet intersection tests and bug fixes

* BitSet symmetricDifference test and bug fix

* starting index test and found interesting bug...

* BitArray init(BitSet) test

* Update BitSetTests.swift

* patch

* bug fix in BitSet index after

* BitSet index before test

* Clean up unneeded code

* Delete BitArrayBenchmarks.swift

* My added, not-working benchmark

* BitSet init from BitArray benchmark

* BiSet insert benchmark

* BitSet forceInsert benchmark

* Passing BitSet index offset by test

I plan to add more to the test to test offsets from indices in the middle and not just start and end

* BitArray testing modification to accommodate varying WORD sizes

* Minor comment clean-up

* Correcting bitset tests for varying WORD sizes

* Headers with License info

* simple set operation comparison

incomplete

* .

* adjustments

* Update BitSetOperations.swift

* Benchmarks and preconditions

* Update BitArrayOperations.swift

* Update BitSetTests.swift

* quick edits

* .

* Documentation for bitwise operations and some initializers

* Testing `==` operator to ensure bug fix

* BitSet SetAlgebra and Operations Documentation

* Update BitSetOperations.swift

Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
Co-authored-by: 3405691582 <dsk@google.com>
Co-authored-by: Vihan <vihan_bhargava@apple.com>
Co-authored-by: Rodrigo Kreutz <8869678+rkreutz@users.noreply.github.com>
Co-authored-by: Andrew Monshizadeh <1282845+amonshiz@users.noreply.github.com>
2021-11-22 14:43:26 -08:00
Vihan Bhargava 62adcfad06 Add exhaustive SortedSet tests and benchmarks.
Key Changes:
 - Add tests and benchmarks for SortedSet
 - Fix bug during _Node.UnsafeHandle.popFirstElement() rebalancing
 - Enable _Node.UnsafeHandle.subscript(elementAt:) to work on value-less nodes.

Minor Changes:
 - Optimize Codable to use _BTree.Builder and forEach
 - Codable now checks for order, not strictly uniqueness
 - Add smaller node size for debug builds to easily catch errors
2021-08-20 00:45:58 -07:00
Karoy Lorentey 0d1ca3240c 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
2021-08-19 11:42:14 -07:00
Vihan Bhargava e67460c942 Finish builder and
Key Changes:
 - Implement Equatable, Hashable for SubSequences
 - Implement SortedDictionary initializers
   - init(keysWithValues:) and init(sortedKeysAndValues:) with named and unnamed variants.
 - Expand benchmark suite for SortedDictionary
 - Commit _BTree.Builder

Minor Changes:
 - Update documentation
 - Expand test suits
 - Fix bug where SubSequences did not define subscript(bounds: Range<Index>)
 - _Node
   - Implement `depth` property for `_Node`
     - Packs both `depth`, `count`, and `capacity` within a single UInt64.
   - Implement `init(leftChild:seperator:rightChild:capacity:)` for `_Node`
   - Implement `concatenateWith(node:seperatedBy:)` to `_Node.UnsafeHandle`
   - Remove bad invariant check on `_Node.UnsafeHandle` deletion subroutines
 - _BTree
   - Add invariant checks as `_BTree.checkInvariants()`
   - Separate `_BTree.*capacity` into `*size` and `*capacity`
 - Make _FixedSizeArray top-level
   - Remove deque behavior.

Documentation:
 - Update complexity documentation style from 'n' to `self.count`

Testing:
 - Expand tests for SortedDictionary
 - Add tests for SortedDictionary.Keys
 - Add tests for _Node.join(...) routines
 - Add tests for _BTree.Builder
 - Restore checkBidirectionalCollection tests for _BTree
2021-08-15 00:22:39 -07:00
Karoy Lorentey f73d5e95a8 Add reference benchmarks for bit vector implementations (#79)
* [benchmark] Reorganize C++/Foundation benchmarks into separate files

* [benchmark] Add reference benchmarks for std::vector<bool> and CFBitVector

* Fix thinko breaking non-Darwin builds
2021-08-13 14:14:26 -07:00
Vihan Bhargava 8de0b4ff7a Implement primary SortedSet methods and various refactors.
Key Changes:
 - SortedSet
   - Implement Partial RangeReplaceableCollection
   - Implement ExpressibleByArrayLiteral
   - Implement init<S: Sequence>(_: S)
   - Implement Set methods:
     - update(with:) / insert(_:) / contains(_:)
 - SortedDictionary
   - Implement SortedDictionary.Values: BidirectionalCollection
   - Implement SortedDictionary.Keys: BidirectionalCollection
 - _BTree
   - Implement Partial RangeReplaceableCollection
   - Implement Sequence
     - Add high performance linear iterator

Minor Changes:
 - Benchmarks
   - Clean up benchmarks
 - _Node.UnsafeHandle
   - @freeze enum InsertionResult
 - _Node.Storage
   - Use UnsafeMutablePointer instead of ManagedBuffer

Refactors:
 - Various refactors for method signatures and documentation.
2021-08-09 19:13:50 -07:00
Vihan Bhargava 3d5d5acb5b Implement B-Tree deletion and respective tests.
Key Changes:
 - Implement removal through SortedDictionary subscript
 - Implement _BTree.contains for efficient existence checking
 - Add tests
   - _Node.UnsafeHandle.rotation/collapse tests
   - _BTree.removeAny tests
 - Expand benchmarks
   - Add C++ reference lookup benchmarks
   - Correct old benchmarks

Minor Changes:
 - Remove B-Tree benchmarks, correct SortedDictionary benchmarks
 - Adjust debug B-Tree printer to show both numElements and numTotalElements
 - Add total count synchronization invariant check
 - Implement CustomReflectable for B-Tree
2021-08-09 19:13:50 -07:00
Vihan Bhargava 9cf2cdadc0 Initial commit for SortedCollections
Signed-off-by: Vihan Bhargava <vihan_bhargava@apple.com>
2021-08-09 19:13:41 -07:00
Karoy Lorentey cc69069676 [benchmark] Review and extend Heap benchmarks (#76)
* [benchmark] Review and extend Heap benchmarks

* FoundationBenchmark only supports Apple platforms

* Rewrite CFBinaryHeap benchmarks in pure Swift
2021-08-07 14:41:02 -07:00
940c963bc4 Add a min-max heap implementation that can be used to back a priority queue (#61)
* Add PriorityQueue implementation built on top of a MinMaxHeap

* Merge MinMaxHeap into PriorityQueue

* Add `unordered` read-only view into underlying heap

* Start filling in PriorityQueue benchmarks

* Implement our own swapAt()

storage.swapAt exhibits excessive allocations

* Rename _delete(at:) to _remove(at:)

* Rename removeMin/removeMax -> popMin/popMax

* Use magic values 1, 2 to refer to the items in the first max level

Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>

* Specify logarithmic complexities as "O(log `count`) / 2" instead of "O(log n)"

Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>

* Clarify logic in popMax

* Simplify logic in _remove(at:)

* Move the bounds checking into the various index computation methods

They will all now return `nil` for invalid indices.

* Floyd's heap construction algorithm should start from count/2 - 1

* Add ObjC wrapper around CFBinaryHeap to benchmarks

* Fix benchmarks that broke because of renames

* Add removeMin/removeMax

* Make _minMaxHeapIsMinLevel an instance method

* Split _indexOfChildOrGrandchild(of:sortedUsing:) into two separate functions

There is a large performance cost with passing a predicate function.

* Defer comparing children when determining largest/smallest descendant

If the given index has 4 grandchildren, we can skip comparing the children.

* Added an iterator of the min and max views to the priority queue

* seperated iterator implementation into a new file

* Use renamed popMin/Max in Iterator instead of removeMin/Max

* Fix code formatting

Indentation of 2 spaces and 80 char column width

* Add sequence initializer

* Fix code formatting in benchmarks

* Fix benchmark names

* Remove init from Collection

This should already be handled by the init from Sequence

* Add conformance to ExpressibleByArrayLiteral

* Move ExpressibleByArrayLiteral conformance to separate file

* Update PriorityQueue's CMakeLists.txt

* Make ascending and descending iterators public

* Inline ALL THE THINGS!

* Iterative instead of recursive implementation, @inline(__always) a couple more critical functions.

* Address PR feedback, thanks!

* Check invariants on insertion and deletion

* Minor code formatting cleanup

* Add copyright header to test file

* Fix missing empty line

* Add naïve implementation of insert(contentsOf:)

* Add documentation on complexity of init<S:Sequence>(_:)

* Cite source paper in documentation

* Rename PriorityQueue -> MinMaxHeap

We'll be reintroducing the PriorityQueue type as a wrapper.

* Mark insert(contentsOf:) as inlinable

This results in ~10x speedup in my initial tests.

* Rename argument label "startingAt" -> "elementAt"

These functions used to be recursive, so "startingAt" made sense.
Now that they're iterative, we should fix the label.

* Remove coefficients from complexity docs

* Make `_minMaxHeapIsMinLevel` take an index instead of a count

* Rename MinMaxHeap -> Heap

* Add documentation for Heap

* Make Heap.Iterator init and direction internal

* Fix reference to queue in documentation

Co-authored-by: Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>

* Don't wrap integers in CFBinaryHeap benchmark in NSNumber

* Avoid heap allocation altogether

* Add table with performance of operations

* Add heap performance graph

* Apply suggestions from code review

Co-authored-by: Karoy Lorentey <klorentey@apple.com>

* Make _checkInvariants comments a doc comment

* Split Heap.Iterator into two separate views

Adapted from Daryle Walker's (github.com/CTMacUser) suggestions

* Prefix heap storage variable with an underscore

* Update benchmark image

* Fix Sources/PriorityQueueModule/CMakeLists.txt

Heap+Iterator.swift was renamed to Heap+OrderedViews.swift

Co-authored-by: Karoy Lorentey <klorentey@apple.com>

* CFBinaryHeap is only available on Darwin

* CFBinaryHeap is only available on Darwin

* CFBinaryHeap is only available on Darwin

Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
Co-authored-by: Amanuel Ephem <amanuelephrem776@gmail.com>
Co-authored-by: Joakim Hassila <joj@mac.com>
Co-authored-by: Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2021-08-06 22:21:23 -07:00
Scott Perry 7b37f7892b Add benchmarks and clean up headerdoc 2021-04-05 20:57:32 -07:00
Karoy Lorentey a2bcac435f Initial import.
Introduce OrderedCollections module
2021-04-05 09:41:00 -07:00