[tests] speed up of tx_validationcache_tests by reusing of CTransaction. #13404

pull lucash-dev wants to merge 1 commits into bitcoin:master from lucash-dev:speedup-tx_validationcache_tests changing 1 files +1 −1
  1. lucash-dev commented at 5:36 AM on June 6, 2018: contributor

    The code was converting CMutableTransaction to CTransaction multiple times, which implies recalculating the hash multiple times. This commit fixes this by reusing a single CTransaction.

    Run-time results:

    Before:  6.7s
    After: 5.5s
    --------------
    Saved: 1.2s
    

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

  2. fanquake added the label Tests on Jun 6, 2018
  3. in src/test/txvalidationcache_tests.cpp:105 in ba4311a515 outdated
     101 | @@ -102,7 +102,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
     102 |  // should fail.
     103 |  // Capture this interaction with the upgraded_nop argument: set it when evaluating
     104 |  // any script flag that is implemented as an upgraded NOP code.
     105 | -static void ValidateCheckInputsForAllFlags(CMutableTransaction &tx, uint32_t failing_flags, bool add_to_cache)
     106 | +static void ValidateCheckInputsForAllFlags(CTransaction tx, uint32_t failing_flags, bool add_to_cache)
    


    Empact commented at 11:02 AM on June 6, 2018:

    Could be const or a const reference.


    MarcoFalke commented at 12:25 PM on June 6, 2018:

    Agree that this should be a const ref


    lucash-dev commented at 1:51 PM on June 6, 2018:

    Fixed.

  4. speed up of tx_validationcache_tests by reusing of CTransaction.
    The code was converting CMutableTransaction to CTransaction multiple times, which implies recalculating the hash multiple times. This commit fixes this by reusing a single CTransaction.
    ebebedce20
  5. MarcoFalke commented at 2:15 PM on June 6, 2018: member

    utACK ebebedce2094ac202bdfdf4b13fed562d35d161d

  6. MarcoFalke merged this on Jun 7, 2018
  7. MarcoFalke closed this on Jun 7, 2018

  8. MarcoFalke referenced this in commit 3d3d8ae3a0 on Jun 7, 2018
  9. UdjinM6 referenced this in commit 8c8b51e5f5 on Jun 19, 2021
  10. UdjinM6 referenced this in commit d02a223c97 on Jun 24, 2021
  11. UdjinM6 referenced this in commit 5bb511dd46 on Jun 26, 2021
  12. UdjinM6 referenced this in commit a13dee3fa7 on Jun 26, 2021
  13. PastaPastaPasta referenced this in commit 02b0442fda on Jun 27, 2021
  14. PastaPastaPasta referenced this in commit 7642625575 on Jun 28, 2021
  15. PastaPastaPasta referenced this in commit 9c23705d84 on Jun 28, 2021
  16. UdjinM6 referenced this in commit e52bf1371b on Jun 28, 2021
  17. PastaPastaPasta referenced this in commit a023431fbc on Jun 29, 2021
  18. MarcoFalke locked this on Sep 8, 2021

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-04-20 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me