Small refactor of CCoinsViewCache::BatchWrite() #11353

pull danra wants to merge 1 commits into bitcoin:master from danra:refactor/coins-view-cache-batch-write changing 1 files +48 −46
  1. danra commented at 3:54 PM on September 16, 2017: contributor

    std::unordered_map::erase( const_iterator pos ) returns an iterator to the element following the removed one. Use that to optimize (probably minor-performance-wise, and definitely code-structure-wise) the implementation of CCoinsViewCache::BatchWrite().

  2. Small refactor of CCoinsViewCache::BatchWrite()
    std::unordered_map::erase( const_iterator pos ) returns an iterator to the element following the removed one. Use that to optimize (probably minor-performance-wise, and definitely code-structure-wise) the implementation of CCoinsViewCache::BatchWrite().
    5b9748f979
  3. meshcollider commented at 3:53 AM on September 17, 2017: contributor

    Note to reviewers, most of the diff is indentation change, so use ?w=1

    Other than adding missing braces to some if-statements which is a style only change, basically all this change does is move the erasure from mapIndex from the end of the loop body into the brackets. @danra small changes like this aren't really that useful to be perfectly honest sorry, its time consuming to review things like this with almost no real benefit to it. It would be a lot more helpful if you wanted to help out in reviewing other, bigger PRs which are blockers for releases, since you obviously know the standards fairly well :)

  4. sipa commented at 4:37 AM on September 17, 2017: member

    @MeshCollider Thanks, adding ?w=1 makes it look like a much more trivial refactor.

    utACK 5b9748f979dd65b229e2882e670794c46e2e720b

  5. fanquake added the label Refactoring on Sep 17, 2017
  6. dcousens approved
  7. gmaxwell approved
  8. gmaxwell commented at 9:13 AM on September 18, 2017: contributor

    ACK.

  9. promag commented at 10:28 AM on September 18, 2017: member

    IMO the only good change here is it = mapCoins.erase(it). Adding braces because indentation, and indentation because of an early continue doesn't sound worth it. Don't get me wrong, but there are lots of other possible refactors like these and I think we don't want that to happen.

    That said, NACK as it is.

  10. gmaxwell commented at 6:10 PM on September 18, 2017: contributor

    @promag If it weren't for the move of the erase into the afterthought I would have also been with you. Since it was being changed I think fixing up the indentation is OKAY.

  11. danra commented at 9:44 PM on September 18, 2017: contributor

    @MeshCollider

    It would be a lot more helpful if you wanted to help out in reviewing other, bigger PRs which are blockers for releases, since you obviously know the standards fairly well :)

    I will/am. I'm posting smaller fixes as I'm learning the code.

    its time consuming to review things like this with almost no real benefit to it.

    Improving both the conciseness and the structure of the code, making it more accessible and easy to reason about, does have real benefit IMHO. @promag The main change isn't the indentation, it's the more concise erase operation done in the for loop. Reducing indentation was a bonus.

  12. TheBlueMatt commented at 1:27 AM on September 21, 2017: member

    utACK 5b9748f979dd65b229e2882e670794c46e2e720b

  13. MarcoFalke commented at 7:24 PM on November 10, 2017: member

    utACK 5b9748f97

  14. MarcoFalke merged this on Nov 10, 2017
  15. MarcoFalke closed this on Nov 10, 2017

  16. MarcoFalke referenced this in commit 05a761932e on Nov 10, 2017
  17. Fabcien referenced this in commit 6ffbbc121d on Aug 30, 2019
  18. PastaPastaPasta referenced this in commit adc66e70a7 on Jan 17, 2020
  19. PastaPastaPasta referenced this in commit a7b9dff07f on Jan 22, 2020
  20. PastaPastaPasta referenced this in commit a969c8d0be on Jan 22, 2020
  21. PastaPastaPasta referenced this in commit 77933a3846 on Jan 29, 2020
  22. ckti referenced this in commit 405967e2c2 on Mar 28, 2021
  23. furszy referenced this in commit 60d36292bc on Jul 26, 2021
  24. DrahtBot 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-22 06:15 UTC

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