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

improve the recover performance by re-using the secpk1 context #178

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

taokayan
Copy link
Contributor

// secp256k1_context is thread safe and can be reused, but the creation is expensive (~10ms)
static secp256k1_context* context = secp256k1_context_create(SILKWORM_SECP256K1_CONTEXT_FLAGS);
// release only when the process exits
static auto _ = gsl::finally([&]() { if (context) std::free(context); });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just moving existing code, and while free() might be fine it seems like this really ought to be secp256k1_context_destroy()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you're right

@taokayan taokayan merged commit c42fe0c into master Oct 2, 2024
5 checks passed
@taokayan taokayan deleted the kayan_recover_perf branch October 2, 2024 09:45
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.

3 participants