mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Right now a wallet descriptor is converted to it's string representation (via `Descriptor::ToString`) repeatedly at different instances: - on finding a `DescriptorScriptPubKeyMan` for a given descriptor (`CWallet::GetDescriptorScriptPubKeyMan`, e.g. used by the `importdescriptors` RPC); the string representation is created once for each spkm in the wallet and at each iteration again for the searched descriptor (`DescriptorScriptPubKeyMan::HasWalletDescriptor`) - whenever `DescriptorScriptPubKeyMan::GetID()` is called, e.g. in `TopUp` or any instances where a descriptor is written to the DB to determine the database key etc. As there is no good reason to calculate a fixed descriptor's string/ID more than once, add the ID as a field to `WalletDescriptor` and calculate it immediately at initialization (or deserialization). `HasWalletDescriptor` is changed to compare the spkm's and searched descriptor's ID instead of the string to take use of that. This speeds up the functional test `wallet_miniscript.py` by a factor of 5-6x on my machine (3m30.95s on master vs. 0m38.02s on PR). The recently introduced "max-size TapMiniscript" test-case introduced a descriptor that takes 2-3 seconds to create a string representation, so the repeated calls to that were significantly hurting the performance. |
||
|---|---|---|
| .. | ||
| rpc | ||
| test | ||
| bdb.cpp | ||
| bdb.h | ||
| coincontrol.cpp | ||
| coincontrol.h | ||
| coinselection.cpp | ||
| coinselection.h | ||
| context.cpp | ||
| context.h | ||
| crypter.cpp | ||
| crypter.h | ||
| db.cpp | ||
| db.h | ||
| dump.cpp | ||
| dump.h | ||
| external_signer_scriptpubkeyman.cpp | ||
| external_signer_scriptpubkeyman.h | ||
| feebumper.cpp | ||
| feebumper.h | ||
| fees.cpp | ||
| fees.h | ||
| init.cpp | ||
| interfaces.cpp | ||
| load.cpp | ||
| load.h | ||
| receive.cpp | ||
| receive.h | ||
| salvage.cpp | ||
| salvage.h | ||
| scriptpubkeyman.cpp | ||
| scriptpubkeyman.h | ||
| spend.cpp | ||
| spend.h | ||
| sqlite.cpp | ||
| sqlite.h | ||
| transaction.cpp | ||
| transaction.h | ||
| types.h | ||
| wallet.cpp | ||
| wallet.h | ||
| walletdb.cpp | ||
| walletdb.h | ||
| wallettool.cpp | ||
| wallettool.h | ||
| walletutil.cpp | ||
| walletutil.h | ||