Prevent copying of in/outputs for SignSignature #13202

pull martinus wants to merge 1 commits into bitcoin:master from martinus:optimize-SignSignature changing 3 files +16 −1
  1. martinus commented at 5:30 pm on May 9, 2018: contributor

    Instead of copying data from a CMutableTransaction into a CTransaction, the data is temporarily moved and then moved back after it’s use. This speeds up the slowest unit test transaction_tests/test_big_witness_transaction:

    24.351 sec for all unit tests before 21.187 sec for all unit tests after this change

    The change is somewhat ugly since a const_cast is necessary.

    Relates to #10026. It should also speed up any use of SignSignature, especially for machines where allocating memory is slow.

  2. prevents copying of in/outputs for SignSignature
    Instead of copying data from a CMutableTransaction into a CTransaction,
    the data is temporarily moved and then moved back after it's use. This speeds up
    the slowest unit test transaction_tests/test_big_witness_transaction.
    
    24.351 sec for all unit tests before
    21.187 sec for all unit tests after this change
    
    The change is somewhat ugly since a const_cast is necessary.
    8b24e65070
  3. martinus renamed this:
    prevents copying of in/outputs for SignSignature
    Prevent copying of in/outputs for SignSignature
    on May 9, 2018
  4. sipa commented at 5:34 pm on May 9, 2018: member

    I believe this is illegal C++. You cannot modify const variables unless you know other non-const references to those variables exist as well. That isn’t the case for CTransaction.

    A better way to speed things up would be to create a MutableTransactionSignatureCreator that works directly on CMutableTransaction instead of converting to a CTransaction first, and then using that.

  5. martinus commented at 5:40 pm on May 9, 2018: contributor
    That sounds much better than the ugly cast, I’ll have a look at that
  6. martinus closed this on May 9, 2018

  7. martinus deleted the branch on May 23, 2018
  8. laanwj referenced this in commit 36fc8052f6 on May 31, 2018
  9. UdjinM6 referenced this in commit 3d00f2c563 on Jun 19, 2021
  10. UdjinM6 referenced this in commit 7a5b4f3aee on Jun 24, 2021
  11. UdjinM6 referenced this in commit f7c2a3844d on Jun 26, 2021
  12. UdjinM6 referenced this in commit 87c9b5c73e on Jun 26, 2021
  13. UdjinM6 referenced this in commit 3d4017d30d on Jun 28, 2021
  14. MarcoFalke locked this on Dec 16, 2021


martinus sipa


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: 2024-11-17 18:12 UTC

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