-
-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
344 additions
and
254 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
c1d189e
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.
@yarikk It's my impression that this implementation does the "more memory efficient approach" in:
from BEP 11.
However there may be a memory leak, in that the event series is never trimmed. I also noted that the "naive" approach would probably actually be faster prior to the changes in this commit.
c1d189e
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.
Indeed, after few iterations I came up with this log-based approach which turned out to match what’s suggested in the BEP.
That’s right, but it’s tricky to trim properly, as, say, having a drop without first having a matching add would constitute a protocol botch.
It’s not the best. But, on the brighter side, it allows to get away without extra locking, and is very simple in principle. I’m not saying it doesn’t worth searching for improvements.
Admittedly, the de-duplication code turned out to be suboptimal, and haven’t received sufficient attention on my part. It haven’t been moved beyond the “dumbest thing that works” up until this change of yours. Good catch!