Skip redundant OP_CODESEPARATOR scan #14786

pull jl2012 wants to merge 1 commits into bitcoin:master from jl2012:skip_codeseparator changing 1 files +2 −1
  1. jl2012 commented at 7:40 pm on November 22, 2018: contributor

    CTransactionSignatureSerializer() scans OP_CODESEPARATOR twice. First time to count the number of OP_CODESEPARATOR, second time to remove OP_CODESEPARATOR. If OP_CODESEPARATOR is not found in the first scan, the second scan is redundant.

    Since the use of OP_CODESEPARATOR is extremely rare, the repeated scan is wasteful is most cases.

  2. Skip redundant OP_CODESEPARATOR scan a5660e2cd3
  3. MarcoFalke added the label Consensus on Nov 22, 2018
  4. MarcoFalke added the label Refactoring on Nov 22, 2018
  5. IlyasRidhuan commented at 4:16 am on November 23, 2018: none
    utACK a5660e2
  6. Empact commented at 5:03 am on November 23, 2018: member

    Concept ACK - any bench results to show the effect?

    Style-nit: brace-less if should be inline: “If an if only has a single-statement then-clause, it can appear on the same line as the if, without braces.” But you may as well nest the while in the if as well, no? https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#coding-style-c

  7. NicolasDorier commented at 5:14 am on November 23, 2018: contributor
    Prefer not changing consensus critical code for performance reason without proper benchmark about it.
  8. laanwj commented at 7:25 am on November 23, 2018: member

    Prefer not changing consensus critical code for performance reason without proper benchmark about it.

    I have to agree here. Let’s be really careful around this code and only change it if necessary.

  9. Sjors commented at 11:32 pm on March 5, 2019: member

    I was staring at this particular piece of code today. I found it pretty hard to read, so if we’re changing this, maybe add some more comments. For example it took me a while to realise CTransactionSignatureSerializer is only used for non-SegWit transactions, which finally helped me understand step 4 in BIP-0143.

    This change looks harmless, but those are famous last words, so I would also encourage a benchmark.

    Both loops start with it at scriptCode.begin() and do while (scriptCode.GetOp(it, opcode). The inside of the second loop does nothing if there’s no OP_CODESEPARATOR in the script.

  10. fanquake added the label Needs Conceptual Review on Jun 25, 2019
  11. DrahtBot closed this on Aug 16, 2019

  12. DrahtBot commented at 1:48 pm on August 16, 2019: member
  13. DrahtBot reopened this on Aug 16, 2019

  14. MarcoFalke commented at 2:45 pm on August 16, 2019: member
    Closing as “up for grabs” per #14786 (comment)
  15. MarcoFalke added the label Up for grabs on Aug 16, 2019
  16. MarcoFalke closed this on Aug 16, 2019

  17. DrahtBot locked this on Dec 16, 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: 2024-12-21 15:12 UTC

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