Skip to content
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

Merged
merged 1 commit into from
Dec 19, 2018

Conversation

cryptocode
Copy link
Contributor

@cryptocode cryptocode commented Dec 18, 2018

After #1483, block_exists (stateblock) is the next function that shows up in the profiling of process_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 current block_exists (where the block type is unknown) is reimplemented in terms of the new one.

Part of #1478

@rkeene rkeene added this to the V18.0 milestone Dec 18, 2018
@rkeene rkeene added enhancement experiment This item indicates that the change is an experiment and is not fully baked labels Dec 18, 2018
@@ -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));
Copy link
Contributor

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

Copy link
Contributor Author

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 :)

Copy link
Contributor

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

Copy link
Contributor

@rkeene rkeene left a 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 !

@rkeene rkeene merged commit dc11556 into nanocurrency:master Dec 19, 2018
@rkeene rkeene removed the experiment This item indicates that the change is an experiment and is not fully baked label Dec 19, 2018
@rkeene
Copy link
Contributor

rkeene commented Dec 19, 2018

Another experiment gone right. Good job !

@cryptocode cryptocode deleted the block_exists-faster-lookup branch January 5, 2019 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants