Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Apr 4, 2019

deriveaddresses dumps all generated addresses into a single FlatSigningProvider, which is also used for looking up information for future derivations. @achow101 points out that the growing data structures may unnecessary increase lookup time for later derivations.

Fix this by separating the provider used for lookups (key_provider) and the one we dump things into.

This gives a 10x speedup for a range of 7000 elements, and probably a larger speedup for larger ranges.

@achow101
Copy link
Member

achow101 commented Apr 4, 2019

I've tried using deriveaddresses on a range of 10000 elements but I don't see any speedup with this compared to master. What command did you use to test?

Regardless, I do think this is a good change, so utACK 41a46cb

@fanquake
Copy link
Member

tACK 41a46cb

I'm seeing a substantial speedup using 41a46cb over master (66ce95a).

addresses

Using a command like time src/bitcoin-cli deriveaddresses "wsh(multi(1,xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB/1/0/*,xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwMkQTPH/0/0/*))#t2zpj2eu" "[0,1000]"

@meshcollider
Copy link
Contributor

utACK 41a46cb

@laanwj
Copy link
Member

laanwj commented Apr 15, 2019

makes sense
utACK 41a46cb

@laanwj laanwj merged commit 41a46cb into bitcoin:master Apr 15, 2019
laanwj added a commit that referenced this pull request Apr 15, 2019
41a46cb Speed up deriveaddresses for large ranges (Pieter Wuille)

Pull request description:

  `deriveaddresses` dumps all generated addresses into a single `FlatSigningProvider`, which is also used for looking up information for future derivations. @achow101 points out that the growing data structures may unnecessary increase lookup time for later derivations.

  Fix this by separating the provider used for lookups (`key_provider`) and the one we dump things into.

  This gives a 10x speedup for a range of 7000 elements, and probably a larger speedup for larger ranges.

ACKs for commit 41a46c:
  achow101:
    Regardless, I do think this is a good change, so utACK 41a46cb
  fanquake:
    tACK 41a46cb
  meshcollider:
    utACK 41a46cb

Tree-SHA512: a1b894ce9d5195d8f9760f44acc6d67a90bb259283fd8c1524c38a222fe53e8c1d35b6653a508b121b7ad91e155c97d26c658f6bdcebf6c360546931e4a26a22
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jun 23, 2020
Summary:
bitcoin/bitcoin@41a46cb

---

Depends on D6626

Backport of Core [[bitcoin/bitcoin#15751 | PR15751]]

Test Plan:
  ninja check
  test_runner.py wallet_importmulti rpc_scantxoutset

Reviewers: #bitcoin_abc, nakihito

Reviewed By: nakihito

Differential Revision: https://reviews.bitcoinabc.org/D6641
kwvg added a commit to kwvg/dash that referenced this pull request Nov 4, 2021
kwvg added a commit to kwvg/dash that referenced this pull request Nov 11, 2021
pravblockc pushed a commit to pravblockc/dash that referenced this pull request Nov 18, 2021
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants