Page MenuHomePhabricator

Merge #13419: [tests] Speed up knapsack_solver_test by not recreating wallet 100 times.
ClosedPublic

Authored by nakihito on Dec 18 2019, 19:52.

Details

Summary

a679109be40491222c458fdbef58f68509dae0bd Speed up knapsack_solver_test by not recreating wallet 100 times. (lucash.dev@gmail.com)

Pull request description:

Optimization of `knapsack_solver_test`by moving an expensive wallet creation to outside a 100x for loop.

On my (slow) machine:

```
before:        9.8s
after:         6.2s
--------------------
saved:         3.6s (36%)
```

This PR was split from #13050. Also see #10026.

Tree-SHA512: bde1a856b5f076a5845e14d1a924855c8c91742c3139b47903081289b21d01fef6f2d1fd8947058728a57de56f877bab3866af8cd1d25ba2daa44411752cdb2f

Backport of Core PR13419
https://github.com/bitcoin/bitcoin/pull/13419/

Review note: Easier to see changes if you hide white space changes (https://github.com/bitcoin/bitcoin/pull/13419/files?utf8=%E2%9C%93&diff=split&w=1)

Test Plan
make check
time(./test_bitcoin --run_test=coinselector_tests/knapsack_solver_test)

Pre-patch:

real    0m4.841s
user    0m4.764s
sys     0m0.076s

Post-patch:

real    0m2.340s
user    0m2.328s
sys     0m0.008s

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Dec 18 2019, 19:52
nakihito edited the test plan for this revision. (Show Details)
This revision is now accepted and ready to land.Dec 19 2019, 07:49