-
Notifications
You must be signed in to change notification settings - Fork 790
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 block existence check when the block type is known #1484
Faster block existence check when the block type is known #1484
Conversation
@@ -217,7 +217,7 @@ void ledger_processor::state_block (rai::state_block const & block_a) | |||
void ledger_processor::state_block_impl (rai::state_block const & block_a) | |||
{ | |||
auto hash (block_a.hash ()); | |||
auto existing (ledger.store.block_exists (transaction, hash)); | |||
auto existing (ledger.store.block_exists (transaction, block_a.type (), hash)); |
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.
Wondering if we can directly put types here & for other similar ledger_processor items like rai::block_type::state
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.
Yeah, I couldn't decide on that :)
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'll be okay -- we can always change it if it shows up in profiling
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.
Looks good to me !
Another experiment gone right. Good job ! |
After #1483,
block_exists (stateblock)
is the next function that shows up in the profiling ofprocess_receive_one
. Currently when checking state blocks, four other tables are checked first. With this, the correct table is checked directly if the block type is known. The currentblock_exists
(where the block type is unknown) is reimplemented in terms of the new one.Part of #1478