Priority Queue

I would love to see a Priority Queue added to this project (and ultimately to the standard library). There is already an issue for this on GitHub.

I'm currently building out a networking client, and we need to be able to prioritize enqueued requests. I have a prototype implementation of a priority queue built on top of an array-backed binary heap. I'm happy to help build this out "for real" in any way that I can.


I would love to help implement PriorityQueue, do you have your prototype up anywhere?

Here's a first-pass implementation of the array-backed binary heap: Binary heap implementation in Swift · GitHub

The priority queue is mostly an interface on top of that that provides enqueue and dequeue.


There's not really much I'd add personally, maybe a Collection and Sequence conformance and subscript and @dynamicMemberCaller with KeyPath in the dynamic member subscript for the Array methods.

I will make suggestion to handle the networking client right now, you can use the OrderedSet with remove and insert like the priority queue.
hope to be useful

What's the process here? I know there were a few students who wanted to work on something like this for GSoC, so I don't want to duplicate work if this is already being done as part of that.

There's a fruitful discussion around some of the design details happening right now in the GitHub issue, so I'd recommend engaging there if you have ideas!

GSoC assignments are finalized May 17th, so even if we receive a student who wants to work on this data structure, it will be helpful for them if we've converged on some of these important design decisions.

Terms of Service

Privacy Policy

Cookie Policy