You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been doing the work to move all chat events in OpenChat to stable memory, but this required StableBTreeMap to implement DoubleEndedIterator since we need to be able to iterate chat events in either direction.
I have implemented this on my own fork (here).
Rather than submit a fairly large PR containing the entire change, I have broken it into 2 deliverable pieces, with this PR being the first one.
Before this PR, the StableBTreeMap cursors would be initialised before iteration starts, which is fine if you'll always be iterating forwards.
But once you can iterate in either direction, it is beneficial to only calculate the cursors for your direction of iteration when required, because if you only iterate in one direction, the cursors for the other direction are never needed.
So all this PR does is delay the initialization of the cursors until the first call to Iterator::next.
Let's add a short description of what the changes are trying to accomplish.
I also notice a non-negligible performance regression for insert operations. Do you have an idea why that might be?
I'm surprised by the performance regression around inserts since I should have only affected reading and iterating over the map. I'll have a look into it tomorrow though.
Let's add a short description of what the changes are trying to accomplish.
I also notice a non-negligible performance regression for insert operations. Do you have an idea why that might be?
I'm surprised by the performance regression around inserts since I should have only affected reading and iterating over the map. I'll have a look into it tomorrow though.
insert also needs to navigate the map to find the point where the value should be inserted, so if your change affects iteration (in more general terms "navigation" in the map), it's not completely unexpected to affect insert I think.
Let's add a short description of what the changes are trying to accomplish.
I also notice a non-negligible performance regression for insert operations. Do you have an idea why that might be?
I'm surprised by the performance regression around inserts since I should have only affected reading and iterating over the map. I'll have a look into it tomorrow though.
insert also needs to navigate the map to find the point where the value should be inserted, so if your change affects iteration (in more general terms "navigation" in the map), it's not completely unexpected to affect insert I think.
Actually, I think we might be seeing a race condition here because around the same time, Islam bumped the canbench version used. By visually comparing the numbers, I think you get pretty much the same after that PR. Yeah, the bot edited the results at some point but not the summary of the comment (still says significant change detected but all results are now within noise, this is a separate issue that we should fix I guess).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've been doing the work to move all chat events in OpenChat to stable memory, but this required
StableBTreeMapto implementDoubleEndedIteratorsince we need to be able to iterate chat events in either direction.I have implemented this on my own fork (here).
Rather than submit a fairly large PR containing the entire change, I have broken it into 2 deliverable pieces, with this PR being the first one.
Before this PR, the
StableBTreeMapcursors would be initialised before iteration starts, which is fine if you'll always be iterating forwards.But once you can iterate in either direction, it is beneficial to only calculate the cursors for your direction of iteration when required, because if you only iterate in one direction, the cursors for the other direction are never needed.
So all this PR does is delay the initialization of the cursors until the first call to
Iterator::next.