Remove redundant assignments (dead stores) #13767

pull practicalswift wants to merge 2 commits into bitcoin:master from practicalswift:remove-redundant-assignments changing 5 files +10 −16
  1. practicalswift commented at 2:34 PM on July 26, 2018: contributor

    Remove redundant assignments (dead stores).

  2. fanquake added the label Refactoring on Jul 26, 2018
  3. Empact commented at 9:18 PM on July 26, 2018: member

    utACK 3e0fd18

  4. promag commented at 1:44 PM on July 27, 2018: member

    utACK 3e0fd18.

  5. paveljanik commented at 7:04 PM on July 27, 2018: contributor

    utACK 3e0fd18

  6. in src/bench/crypto_hash.cpp:92 in 3e0fd18620 outdated
      91 |  {
      92 |      FastRandomContext rng(true);
      93 | -    uint32_t x = 0;
      94 |      while (state.KeepRunning()) {
      95 | -        x += rng.randbool();
      96 | +        rng.randbool();
    


    MarcoFalke commented at 7:14 PM on July 27, 2018:

    Have you checked if this changes the benchmark result. If yes, how much?


    practicalswift commented at 1:24 PM on August 2, 2018:
    $ ./bench_bitcoin-before -filter=FastRandom_1bit
    WARNING: This is a debug build - may result in slower benchmarks.
    # Benchmark, evals, iterations, total, min, max, median
    FastRandom_1bit, 5, 440000000, 19.4505, 8.68817e-09, 9.03337e-09, 8.84262e-09
    $ ./bench_bitcoin-after -filter=FastRandom_1bit
    WARNING: This is a debug build - may result in slower benchmarks.
    # Benchmark, evals, iterations, total, min, max, median
    FastRandom_1bit, 5, 440000000, 19.2027, 8.66309e-09, 8.81773e-09, 8.71708e-09
    

    @MarcoFalke, looks OK? :-)

  7. in src/bench/rollingbloom.cpp:27 in 3e0fd18620 outdated
      23 | @@ -25,7 +24,7 @@ static void RollingBloom(benchmark::State& state)
      24 |          data[1] = count >> 16;
      25 |          data[2] = count >> 8;
      26 |          data[3] = count;
      27 | -        match += filter.contains(data);
      28 | +        filter.contains(data);
    


    MarcoFalke commented at 7:14 PM on July 27, 2018:

    Same here


    practicalswift commented at 1:25 PM on August 2, 2018:
    $ ./bench_bitcoin-before -filter=RollingBloom
    WARNING: This is a debug build - may result in slower benchmarks.
    # Benchmark, evals, iterations, total, min, max, median
    RollingBloom, 5, 1500000, 13.066, 1.72693e-06, 1.76851e-06, 1.74017e-06
    $ ./bench_bitcoin-after -filter=RollingBloom
    WARNING: This is a debug build - may result in slower benchmarks.
    # Benchmark, evals, iterations, total, min, max, median
    RollingBloom, 5, 1500000, 13.2987, 1.75024e-06, 1.82156e-06, 1.76487e-06
    

    @MarcoFalke, looks good as well? :-)

  8. in src/txmempool.cpp:654 in 3e0fd18620 outdated
     654 |                  const CTransaction& tx2 = it2->GetTx();
     655 |                  assert(tx2.vout.size() > txin.prevout.n && !tx2.vout[txin.prevout.n].IsNull());
     656 |                  fDependsWait = true;
     657 | -                if (setParentCheck.insert(it2).second) {
     658 | -                    parentSizes += it2->GetTxSize();
     659 | -                    parentSigOpCost += it2->GetSigOpCost();
    


    MarcoFalke commented at 7:16 PM on July 27, 2018:

    Instead of removing them, shouldn't they be asserted against GetSizeWithAncestors et al?


    practicalswift commented at 12:50 PM on August 2, 2018:

    @MarcoFalke I believe that is done later in the function – see ce019bf90fe89c1256a89c489795987ef0b8a18f. Am I reading it correctly? :-)


    MarcoFalke commented at 1:17 PM on August 2, 2018:

    Right. Looks good.

  9. MarcoFalke commented at 7:17 PM on July 27, 2018: member

    Thanks for taking a look here, but I am not yet convinced just removing them is the obviously correct thing to do.

  10. Remove redundant assignments (dead stores) cdf4089457
  11. Remove unused variable dd777f3e12
  12. practicalswift force-pushed on Aug 2, 2018
  13. practicalswift commented at 12:32 PM on August 2, 2018: contributor

    Rebased and cherry picked 39ee3e85d12604e10fcded75bb55c2a547158271 into this PR from #13847 as suggested by @fanquake :-)

  14. MarcoFalke commented at 2:17 PM on August 2, 2018: member

    utACK dd777f3e12

  15. Empact commented at 6:59 PM on August 2, 2018: member

    utACK dd777f3

  16. practicalswift commented at 4:17 PM on August 27, 2018: contributor

    @promag @paveljanik Would you mind re-reviewing your previous utACK:s? :-)

  17. MarcoFalke referenced this in commit fea4e9eca5 on Aug 27, 2018
  18. MarcoFalke merged this on Aug 27, 2018
  19. MarcoFalke closed this on Aug 27, 2018

  20. jasonbcox referenced this in commit fb43752bb6 on Oct 11, 2019
  21. jonspock referenced this in commit 60ec3efb02 on Dec 27, 2019
  22. jonspock referenced this in commit 66971e30c6 on Dec 29, 2019
  23. practicalswift deleted the branch on Apr 10, 2021
  24. Munkybooty referenced this in commit bb592c262a on Jun 30, 2021
  25. Munkybooty referenced this in commit 1d4f3edb8d on Jul 2, 2021
  26. pravblockc referenced this in commit c4ddf6486f on Jul 26, 2021
  27. pravblockc referenced this in commit 3bbd17c9e3 on Aug 3, 2021
  28. pravblockc referenced this in commit 49a7a8ad48 on Aug 3, 2021
  29. pravblockc referenced this in commit 6de74e958d on Aug 3, 2021
  30. pravblockc referenced this in commit f3dbd9e16e on Aug 3, 2021
  31. gades referenced this in commit 1fc808cb5b on May 24, 2022
  32. DrahtBot locked this on Aug 16, 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-04-16 15:15 UTC

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