-
Couldn't load subscription status.
- Fork 1.4k
Implement TPriorityQueue #3756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement TPriorityQueue #3756
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Would it make sense to construct a priority queue at construction without specifying offerAll or that's really redundant with offerAll since that works just as well?
|
@adamgfraser I might back with |
|
@jdegoes Based on the last benchmarks we have they're comparable, but we might have some "cut-offs" with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mijicd
What about performance of TArray? I think the typical implementation of a PriorityQueue is based on a Heap, which is based on an Array in turn.
So what about splitting this into a pr for a THeap and then the actual TPriorityQueue?
|
If we do it with Other thing we could potentially do here is implement our heap structure like a pairing heap instead of using |
I find using Int too limiting for priority as I have timestamps in mind (like epoch) and those are ultimately Long and assume values that could not be accommodated by Ints. I think time priority is fairly common usage. |
|
@adamgfraser For this PR, I wouldn't change from |
|
@jdegoes Okay, yeah I realized we can just do it as |
|
Okay, I think I addressed everyone's comments. If people are good with this let's merge and then I can optimize the internal representation in a follow up PR. |
|
Initial version with |
|
@adamgfraser I agree the overhead of this will be extremely high, and a |
Simple
TPriorityQueueimplementation extracted from some of my previous work involving theTestClock.Copying @phderome.