Changeset View
Changeset View
Standalone View
Standalone View
src/bench/coin_selection.cpp
| Show All 28 Lines | |||||
| // Simple benchmark for wallet coin selection. Note that it maybe be necessary | // Simple benchmark for wallet coin selection. Note that it maybe be necessary | ||||
| // to build up more complicated scenarios in order to get meaningful | // to build up more complicated scenarios in order to get meaningful | ||||
| // measurements of performance. From laanwj, "Wallet coin selection is probably | // measurements of performance. From laanwj, "Wallet coin selection is probably | ||||
| // the hardest, as you need a wider selection of scenarios, just testing the | // the hardest, as you need a wider selection of scenarios, just testing the | ||||
| // same one over and over isn't too useful. Generating random isn't useful | // same one over and over isn't too useful. Generating random isn't useful | ||||
| // either for measurements." | // either for measurements." | ||||
| // (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484) | // (https://github.com/bitcoin/bitcoin/issues/7883#issuecomment-224807484) | ||||
| static void CoinSelection(benchmark::State &state) { | static void CoinSelection(benchmark::State &state) { | ||||
| const CWallet wallet(Params()); | const CWallet wallet(GetConfig()); | ||||
| std::vector<COutput> vCoins; | std::vector<COutput> vCoins; | ||||
| LOCK(wallet.cs_wallet); | LOCK(wallet.cs_wallet); | ||||
| while (state.KeepRunning()) { | while (state.KeepRunning()) { | ||||
| // Empty wallet. | // Empty wallet. | ||||
| for (COutput output : vCoins) { | for (COutput output : vCoins) { | ||||
| delete output.tx; | delete output.tx; | ||||
| } | } | ||||
| Show All 19 Lines | |||||