rust-bitcoin / rust-bitcoin/rust-miniscript
Creating a secp context in `to_public_key` is expensive when deriving many elements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
I am generating a lot of script pubkeys from a descriptor and creating the context every time is pretty expensive (about 20 microseconds each)
Clearly is convenient not passing the secp context in the API in most cases that are not requiring generating a lot of scripts/address so I am not sure how to improve this but I wanted to point this out
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/descriptor/key.rs around line 1321 and inspect how to_public_key creates the secp context. Reproduce or benchmark repeated script pubkey derivation to measure the context-creation cost. Done means reducing repeated context setup while preserving the existing convenient API behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100