-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
common/prque: generic priority queue #26286
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.
Submodule [evm-benchmarks](https://github.com/ipsilon/evm-benchmarks) updated 25 files
?
Whaaaa, maybe I didn't update my submodules to whatever was on master? |
d251cef
to
04e7f0f
Compare
04e7f0f
to
ee6c890
Compare
@holiman Fixed, PTAL |
type Prque struct { | ||
cont *sstack | ||
type Prque[V any] struct { | ||
cont *sstack[V] |
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.
I think we could have parameters P comparable, V any
here. That way, one could use any integer type as key.
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.
LES uses some weird "wrap around" notion for the priorities, which requires subtracting one priority from another. @zsfelfoldi said that that is a temporary hack 2 years ago :P Until that's fixed, I can't make the priority "comparable" only.
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.
This would be the code to make the priority generic too: #26290, but it changes LES in - a probably silently - breaking way. We need a fix / confirm frmo @zsfelfoldi to make this change.
This PR converts
common/prque
to generics and does the necessary refactors to have the code use the new style.There are two instances in our code:
downloader.queue.expire
andtrie.Sync
where I couldn't properly convert because we add 2 different types of items into the same queue:downloader.queue.expire
is a generic method that's called on different queue types, but there's no way to have typed method, limitation of go.