Huge performance improvement (450%) for zapwallettxes.
Also improves performance for RPC listtransactions.
(For comparison, removing smart-time entirely is only 340%)
Huge performance improvement (450%) for zapwallettxes.
Also improves performance for RPC listtransactions.
(For comparison, removing smart-time entirely is only 340%)
I would guess maybe 40 bytes per transaction. I am running some tests to compare.
The current code is very poor for zapwallettxes because it will re-sort the entire wallet transactions, every time it adds a new one.
With a wallet containing 10184 transactions, I did not observe any measurable memory overhead to the cache.
0 SIZE VSZ SZ
1329352 347192 86798 d78a880
2320552 338396 84599 d78a880+5873cc8
188@@ -189,7 +189,7 @@ bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccount
189 return Write(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry);
190 }
191
192-bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
193+bool CWalletDB::WriteAccountingEntry_ForWalletOnly(const CAccountingEntry& acentry)
nit: use a better method name? Maybe
0_WriteAccountingEntry(const CAccountingEntry& acentry) //should only be called from the CWallet
Nice!
Adding a wtx to the wallet could also be faster (especially big wallets) because AddToWallet()
does also call OrderedTxItems()
(which reads in all the whole transaction history).
utACK.
concept ACK, light utACK
Also, I feel like any memory overhead required would already exist instantaneously at the call site anyway, this just persists the requirement for the lifetime of the application instead?
edit: To clarify, this doesn’t really require any extra memory, except in that it is now persistent across the applications lifetime, not just when needed.
Increased memory from 1.5GB on master to 1.8GB Improved zapwallet time to 5 minutes from something approximating infinity
$ ./src/bitcoin-cli -testnet getwalletinfo { “walletversion”: 60000, “balance”: 1937898.88787003, “unconfirmed_balance”: 0.00000000, “immature_balance”: 1275.53301591, “txcount”: 776267, “keypoololdest”: 1446285387, “keypoolsize”: 999999, “paytxfee”: 0.00000000 }
@pstratem Pull request 6850 will improve zapwallet / rescan time similarly with no memory increase. However, this pull request will be good for AddToWallets when near the tip, where there is intermittent CPU spiking when the indexes are recreated.
IMO, this pull request is needed even with the memory increase, but 6850 is less controversial.
@gmaxwell I would expect any memory increase to be within “measurement error” tolerances, i.e. not significant. This is essentially just storing another index (or two?). It’s great that your measurements seem to agree.
And the previous code which ultimately recreated the indexes on each AddToWallet is simply bad.
Huge performance improvement (450%) for zapwallettxes
luke-jr
laanwj
jonasschnelli
dcousens
fanquake
gmaxwell
pstratem
bittylicious
Labels
Wallet
Milestone
0.12.0