test: Add wallet_balance benchmark #15779

pull MarcoFalke wants to merge 2 commits into bitcoin:master from MarcoFalke:1904-benchWallet changing 8 files +85 −15
  1. MarcoFalke commented at 10:19 PM on April 9, 2019: member

    No description provided.

  2. fanquake added the label Tests on Apr 9, 2019
  3. MarcoFalke force-pushed on Apr 10, 2019
  4. MarcoFalke force-pushed on Apr 10, 2019
  5. MarcoFalke force-pushed on Apr 10, 2019
  6. MarcoFalke force-pushed on Apr 10, 2019
  7. MarcoFalke force-pushed on Apr 10, 2019
  8. MarcoFalke force-pushed on Apr 10, 2019
  9. MarcoFalke commented at 2:16 PM on April 11, 2019: member

    Going to reopen next week

  10. MarcoFalke closed this on Apr 11, 2019

  11. MarcoFalke reopened this on Apr 15, 2019

  12. MarcoFalke force-pushed on Apr 15, 2019
  13. MarcoFalke force-pushed on Apr 15, 2019
  14. MarcoFalke force-pushed on Apr 15, 2019
  15. MarcoFalke force-pushed on Apr 15, 2019
  16. bench: Add wallet_balance benchmarks fa46ac3127
  17. MarcoFalke force-pushed on Apr 15, 2019
  18. MarcoFalke commented at 6:24 PM on April 16, 2019: member

    this is ready for review now

  19. MarcoFalke cross-referenced this on Apr 17, 2019 from issue wallet: add cachable amounts for caching credit/debit values by kallewoof
  20. laanwj commented at 4:05 PM on April 17, 2019: member

    utACK fa46ac3127142358116c8473741708b3bb70ca15

  21. in src/bench/wallet_balance.cpp:18 in fa46ac3127 outdated
      13 | +struct WalletTestingSetup {
      14 | +    std::unique_ptr<interfaces::Chain> m_chain = interfaces::MakeChain();
      15 | +    CWallet m_wallet;
      16 | +
      17 | +    WalletTestingSetup()
      18 | +        : m_wallet{m_chain.get(), WalletLocation(), WalletDatabase::CreateMock()}
    


    ryanofsky commented at 4:18 PM on April 17, 2019:

    Could get rid of WalletTestingSetup constructor and just initialize m_wallet directly above.

  22. in src/bench/wallet_balance.cpp:35 in fa46ac3127 outdated
      30 | +    const auto& ADDRESS_WATCHONLY = ADDRESS_BCRT1_UNSPENDABLE;
      31 | +
      32 | +    WalletTestingSetup wallet_t{};
      33 | +    auto& wallet = wallet_t.m_wallet;
      34 | +    {
      35 | +        bool first_run;
    


    ryanofsky commented at 4:21 PM on April 17, 2019:

    I think there's no need for this to be indented, but I guess it's reasonable to limit the scope the first_run variable.

  23. in src/bench/wallet_balance.cpp:13 in fa46ac3127 outdated
       8 | +#include <optional.h>
       9 | +#include <test/util.h>
      10 | +#include <validationinterface.h>
      11 | +#include <wallet/wallet.h>
      12 | +
      13 | +struct WalletTestingSetup {
    


    ryanofsky commented at 4:32 PM on April 17, 2019:

    This seems fine, but in the future it might be better not have two different structs called WalletTestingSetup with different implementations. (The other one is https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/wallet_test_fixture.h), because if the other WalletTestingSetup struct is ever used in a benchmark, it might result in weird link errors or even runtime errors.

    I think if you just took the handleNotifications method below and moved it to the CWallet class as a public method, this struct would be simpler and no longer need to be declared a CWallet friend, and it could move to a private namespace to avoid conflicting with the other struct.

  24. ryanofsky approved
  25. ryanofsky commented at 4:37 PM on April 17, 2019: contributor

    utACK fa46ac3127142358116c8473741708b3bb70ca15

  26. refactor: Add handleNotifications method to wallet
    Further stylistic cleanups in touched files:
    
    * Sort the includes
    * Wrap long single-line constructors into multiple lines
    fad7c33342
  27. MarcoFalke force-pushed on Apr 17, 2019
  28. MarcoFalke commented at 6:54 PM on April 17, 2019: member

    Added a method to the wallet to handle notifications (and removed the friend struct workarounds in tests)

  29. ryanofsky approved
  30. ryanofsky commented at 7:07 PM on April 17, 2019: contributor

    utACK fad7c33342cb51b310a7dd372bfa675df8810367. I might squash or rearrange the commits to avoid adding code in one commit that just gets deleted in the next one. But overall this looks good and the cleanup is nice.

  31. MarcoFalke referenced this in commit dae72998e8 on Apr 17, 2019
  32. MarcoFalke merged this on Apr 17, 2019
  33. MarcoFalke closed this on Apr 17, 2019

  34. MarcoFalke deleted the branch on Apr 17, 2019
  35. deadalnix referenced this in commit bf444f46b2 on May 23, 2020
  36. deadalnix referenced this in commit bef2081ba9 on May 23, 2020
  37. in src/test/util.cpp:25 in fad7c33342
      21 | @@ -22,6 +22,8 @@
      22 |  
      23 |  #include <boost/thread.hpp>
      24 |  
      25 | +const std::string ADDRESS_BCRT1_UNSPENDABLE = "bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3xueyj";
    


    decryp2kanon commented at 1:09 PM on October 23, 2020:

    interesting. just curious, how to create this un-spendable address? @MarcoFalke

  38. kwvg referenced this in commit dfe6266664 on Oct 12, 2021
  39. kwvg referenced this in commit 10f0d8502e on Oct 12, 2021
  40. kwvg referenced this in commit 7f8f9b56b0 on Oct 12, 2021
  41. kwvg referenced this in commit f42b6a5c1e on Oct 12, 2021
  42. kwvg referenced this in commit 8bf278a37f on Oct 12, 2021
  43. kwvg referenced this in commit c7ad657fc1 on Oct 25, 2021
  44. kwvg cross-referenced this on Oct 25, 2021 from issue merge bitcoin#13219...#15779: benchmarks by kwvg
  45. kwvg referenced this in commit 597d5e5387 on Oct 25, 2021
  46. kwvg referenced this in commit 046fcc2060 on Oct 25, 2021
  47. UdjinM6 referenced this in commit 61a69cf09b on Oct 25, 2021
  48. kwvg referenced this in commit 092c145395 on Oct 31, 2021
  49. kwvg cross-referenced this on Oct 31, 2021 from issue merge bitcoin#10973: separate wallet from node by kwvg
  50. kwvg cross-referenced this on Nov 1, 2021 from issue merge bitcoin#10973, #15039, #15288: separate wallet from node by kwvg
  51. kwvg referenced this in commit 4062f84b71 on Nov 1, 2021
  52. kwvg referenced this in commit b2dec899e7 on Nov 1, 2021
  53. kwvg referenced this in commit 0f0d2b1805 on Nov 1, 2021
  54. kwvg referenced this in commit 6c9ad91b2f on Nov 1, 2021
  55. kwvg referenced this in commit 0c23c7e756 on Nov 4, 2021
  56. kwvg referenced this in commit 41e2707e69 on Nov 4, 2021
  57. kwvg referenced this in commit 1a47ff7fe5 on Nov 6, 2021
  58. kwvg referenced this in commit 3b067a3883 on Nov 14, 2021
  59. kwvg referenced this in commit 0ac021f903 on Nov 14, 2021
  60. kwvg referenced this in commit 0596058467 on Nov 14, 2021
  61. kwvg referenced this in commit 6cc3648fae on Nov 14, 2021
  62. pravblockc referenced this in commit 3ad196bb32 on Nov 18, 2021
  63. pravblockc referenced this in commit 0431ddc8b3 on Nov 18, 2021
  64. bitcoin locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:54 UTC