-
Notifications
You must be signed in to change notification settings - Fork 27
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
deque #106
Comments
Hey @bitdivine, a deque would certainly be a nice addition. I can see it being implemented either on top of |
Hello @ielashi . Thank you for the response. The nns-dapp has a queue of transactions. New transactions are added to the front, old ones are removed from the back. Transactions have sequential numerical indices from N to N+K. The current implementation is a VecDeque that is serialized and deserialized on every upgrade; I am looking at moving that into a stable structure. Off the top of my head every entry is about 120 bytes and there are half a million entries. I don't have any throughput numbers at the tips of my fingers. I guess that stable structures also have to be stable in the sense that an implementation has to be compatible with earlier versions, so switching from one implementation to another might not work but if the implementations have different names, developers have to make a conscious choice to move from one to the other. Best wishes, Max |
Thanks for the context @bitdivine. As discussed, we have a few options: Build a deque based on stable
|
Thank you for the update. For this deque I am pretty sure we won't need variable sizes, but on the other hand performance is not a constraint either so a deque built on BTreeMap would work well, as far as I can see. |
It is not a FIFO, pop is to remove items at the end of the vector. I'm using MinHeap instead, but I'm expecting a queue structure like:
|
BtreeMap will support deque after this PR #106. And more methods for BTreeMap for #87 --------- Co-authored-by: Islam El-Ashi <[email protected]>
Thank you for the stable structures.
Would it be possible to add a deque to the set of structures? Either simulated under the hood as a BTreeMap or as a separate implemementation?
If you are short of time, I can definitely provide a PR with a BTreeVecDeque. For a native implementation I would have to spend some time reading through your code before I could make an offer.
The text was updated successfully, but these errors were encountered: