Kyle Macomber

Results 29 comments of Kyle Macomber

This looks really good! @timvermeulen Could you lend a second pair of eyes and review the heap logic? > The `PriorityQueue` type is a very thin wrapper on top of...

> In the case of `Sequence` conformance, how do we handle the double-endedness of the `PriorityQueue`? i.e. Should `next()` iterate from lowest to highest priority or vice-versa? Maybe `PriorityQueue` shouldn't...

> https://developer.apple.com/documentation/swift/bidirectionalcollection ? If we can provide a bidirectional collection view I think that'd work great: ```swift for elt in q.sortedElements { // iterates from min to max } for...

>> Because min and max values are determined during the remove operation, the priority queue does not lend itself easily to random access of elements via indexes. This was my...

> Other possible naming options: `ascendingElements`/`descendingElements`, or `increasingElements`/`decreasingElements`. I think the former of these two could go better together with the Foundation type `ComparisonResult` with its cases `orderedAscending` etc. I...

> Here's a first pass at performance tests: > > @AquaGeek Nice! It'd be great to see how the performance compares to [CFBinaryHeap](https://developer.apple.com/documentation/corefoundation/cfbinaryheap-s11) for equivalent operations (e.g. `CFBinaryHeapAddValue` and `CFBinaryHeapGetMinimum`)!

> [ ] Figure out if `@inlinable` is required `@inlinable` is definitely required and it dramatically improves performance! I did a naive find and replace adding `@inlinable` to every method...

> > `public mutating func insert(contentsOf newElements: S) where S.Element == Element` > > I was trying to figure out if there is a performant way to do this — ...

> OK, invariant checks have been added. Anything else we need to address here? (cc/ @kylemacomber) This is our first big addition to the collections package, so there's not really...

I'm open to other directions, but I think it might be good to rename this type to `Heap` and land it with no additional features (maybe into a PriorityQueue feature...