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

use custom VoteState parser everywhere #1738

Closed
wants to merge 4 commits into from

Conversation

2501babe
Copy link
Member

@2501babe 2501babe commented Jun 13, 2024

Problem

earlier this year we implemented VoteState::deserialize_into(), a custom parser intended to be suitable for usage in a bpf context. we want to use the new parser everywhere because, with some optimizations, it is 7-20x faster than bincode depending on the input

HANA custom vs bincode
* we win: 10000, they win: 0
* our max 22.422µs, their max 471.89µs
* our avg 5.76µs, their avg 35.956µs
* avg speedup 30.195µs

it also uses half as much memory for V1_14_11 because conversion to Current happens during parsing

Summary of Changes

use VoteState::deserialize_into() as the new implementation for VoteState::deserialize(). we also remove the check for prior_voters sparsity that wouldnt exist in bincode and remove unnecessary uses of serialized_size() which drastically improve runtime

this wont be merged immediately. the plan is to cherrypick the new parser into a 2.x codebase and run that as a validator on mainnet for a few epochs to confirm everything works identically, because it is impossible to feature-gate this change

the hope is enough vote parsing happens that this will have a nontrivial performance improvement, but that is something to figure out how to measure

fixes solana-labs#35101

@2501babe 2501babe changed the title 20240613 neovotestate use custom VoteState parser everywhere Jun 13, 2024
@2501babe
Copy link
Member Author

new plan is to split this in half, merge the deserialize_into fixes now, and delay replacing deserialize until later, so that deserialize_into can be used to optimize vote processing

@2501babe 2501babe closed this Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use VoteState::deserialize_into() in place of bincode everywhere
1 participant