-
Notifications
You must be signed in to change notification settings - Fork 39
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
Faster pruner #2376
Faster pruner #2376
Conversation
… refactor/faster-pruner
… refactor/faster-pruner
… refactor/faster-pruner
@@ -6,6 +6,7 @@ | |||
|
|||
#pragma once | |||
|
|||
#include <boost/asio/defer.hpp> |
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.
Why use defer
?
How is it different from post
?
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.
"The use of defer(), rather than post , indicates the caller's preference that the executor defer the queueing of the function object."
https://live.boost.org/doc/libs/1_76_0/doc/html/boost_asio/reference/defer/overload1.html
|
||
// use optional because MerkleValue doesn't have a default constructor | ||
std::optional<MerkleValue> merkle; | ||
if (policy == TraversePolicy::UncachedOnly |
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.
Names if (uncached) return cache
look strange?
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 don't like TraversePolicy naming very much, bui it's the best I came up with. I'll leave a comment in this place.
[self = shared_from_this()](auto &io_ctx) { | ||
// to let new blocks pass through, otherwise new blocks wait too long | ||
// for pruner mutex | ||
auto timer = std::make_shared<boost::asio::steady_timer>( |
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.
Should we create new timer each time or reuse existing?
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 it's a bit more convenient code-wise to just create a new one, so since this operation is performed rarely, I'd leave it as is.
… refactor/faster-pruner
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.
💪
Referenced issues
resolves #1683
Description of the Change
Possible Drawbacks
Checklist Before Opening a PR
Before you open a Pull Request (PR), please make sure you've completed the following steps and confirm by answering 'Yes' to each item: