-
Notifications
You must be signed in to change notification settings - Fork 724
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
Improve cost of BLS key serialization for gRPC #1343
Conversation
Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
Signed-off-by: Sam Batschelet <sam.batschelet@avalabs.org>
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.
lgtm, there may be other places in the codebase where we can use this optimization (matter for a different PR)
Yeah I was going to break out the logic into funcs my fear is someone using the it in the wrong place (like me :)) to grab a perf gain and opening vuln. |
Note: this will require a protocol version bump
Why this should be merged
This PR is a followup to #1326 where we benchmarked the serialzation costs of BLS public keys. The profile from bench showed that the majority of the cost was spent in CGO on very expensive operations including Compressing, Decompressing bytes and re-verifying the keys. Verification was not explicitly required because the keys were already verified before being added to the P-Chain.
before
after
result: ~97% reduction in CPU time.
profiles
benchvset.cpu.txt
benchvset.mem.txt
Closes #1327
How this works
Remove and replace unnecessarily expensive calls to CGO with less expensive variants.
How this was tested
manually