Added some breaks to some BOOST_FOREACH #1735

pull xanatos wants to merge 1 commits into bitcoin:master from xanatos:master changing 3 files +15 −0
  1. xanatos commented at 1:03 PM on August 28, 2012: none

    After the first time the if is true, it's quite useless to check the other nOffset of vSorted.

  2. freewil commented at 1:13 PM on August 28, 2012: contributor

    LGTM but you should rebase so there isnt 5 commits

  3. gmaxwell commented at 5:59 PM on August 28, 2012: contributor

    Indeed, this doesn't need three commits and two merges.

    Does this actually result in different code? The loops have no real side effects, I don't know how terribly the boost foreach is, but it's not inconceivable to me that the compiler could already do this with these loops because they're simple single assignment.

  4. BitcoinPullTester commented at 4:38 PM on August 29, 2012: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/bbcb74effad812ebf418627133341ba05e373b95 for binaries and test log.

  5. laanwj commented at 5:48 PM on August 29, 2012: member

    Would be ok with me if rebased into one commit

  6. gavinandresen commented at 5:59 PM on August 29, 2012: contributor

    I don't like these kind of obsessive-compulsive source code changes, I think they're a waste of time.

    If you're rewriting old code for some reason, then feel free to clean it up. Otherwise I think it is better left alone.

  7. jgarzik commented at 6:05 PM on August 29, 2012: contributor

    Agree that it does smell like premature optimization, with zero proof of actual need or benefit

  8. xanatos commented at 6:42 PM on August 29, 2012: none

    The objective isn't only a (probably null) optimization. I see it as "let's make it clear what is the meaning of the code". Is it "looking for at least one element with a condition" or is it "using an hidden side-effect of enumerating the collection/checking the condition"? The first time I watched the code I asked myself: why isn't it breaking if it is only looking for a single value?

    For the rebase... I'm a noob of git... This evening I'll try to do it.

  9. Added some break(s) to some BOOST_FOREACH de6a850c84
  10. xanatos commented at 7:41 PM on August 29, 2012: none

    Rebased (I hope... In the end after fighting with the rebase -interactive I installed the TortoiseHg and, after fighting against its rebase I used the reset command)

  11. jgarzik commented at 3:58 PM on September 4, 2012: contributor

    It's still adding source code and binary code size without much benefit. We definitely appreciate people reading the source codebase this closely, though! It is this kind of attention to detail that benefits all bitcoin users.

  12. jgarzik closed this on Sep 4, 2012

  13. owlhooter referenced this in commit 7e96af4e65 on Oct 10, 2018
  14. 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-29 03:16 UTC

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