rust-bitcoin / rust-bitcoin/rust-miniscript

Creating a secp context in `to_public_key` is expensive when deriving many elements

Open
#847 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
426
Forks
200
Avg merge
7d 17h
Merged PRs (30d)
8

Description

https://github.com/rust-bitcoin/rust-miniscript/blob/7ba28c0eb8926d36b8e174327779e2f03c235e26/src/descriptor/key.rs#L1321

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.