[*.cc,*.cpp] Reduce push_back #20875

pull SamuelMarks wants to merge 3 commits into bitcoin:master from SamuelMarks:push-back changing 9 files +47 −43
  1. SamuelMarks commented at 12:26 PM on January 7, 2021: none

    Expecting lots of push back to reduce push_back. These are extremely minor micro-optimisations, so feel free to just close the issue based on that.

    PS: There are also a number of other minor optimisations whence elements are individually push_backed in succession, that could be replaced through a trivial vector::insert of a list (brace) initialisation.

    What do you think? - Worth caring about / merging, or best to close a PR for such minor an optimisation?

  2. [*.cc,*.cpp] Reduce push_back bfcd7fc8c7
  3. [*.cc,*.cpp] Reduce push_back through initialiser syntax caaaa0085f
  4. laanwj commented at 12:38 PM on January 7, 2021: member

    Thanks for your contribution!

    But yes, in general we only do optimization changes when a benchmark proves that it speeds up something relevant in a statistically significant way. Changes that span the entire tree are also discouraged.

    I think your changes look okay in themselves, except one inside leveldb. That's a subtree, changes to third-party libraries should go to their upstream repository unless there's a strong reason to deviate from theirs.

    What do you think? - Worth caring about / merging, or best to close a PR for such minor an optimisation?

    I can't give this an concept ACK.

  5. [src/leveldb/util/coding_test.cc] Revert to 8a720ced5ff2fdd23b6ec7688998ad29e54fac98 56c579d6b1
  6. SamuelMarks commented at 12:42 PM on January 7, 2021: none

    Thanks for your speedy feedback @laanwj. I've removed the third party lib change. Your lack of concept ACK… is that encouraging me to close this PR?

  7. DrahtBot added the label Mining on Jan 7, 2021
  8. DrahtBot added the label P2P on Jan 7, 2021
  9. DrahtBot added the label RPC/REST/ZMQ on Jan 7, 2021
  10. DrahtBot added the label Validation on Jan 7, 2021
  11. DrahtBot added the label Wallet on Jan 7, 2021
  12. laanwj removed the label Mining on Jan 7, 2021
  13. laanwj removed the label P2P on Jan 7, 2021
  14. laanwj removed the label RPC/REST/ZMQ on Jan 7, 2021
  15. laanwj removed the label Validation on Jan 7, 2021
  16. laanwj removed the label Wallet on Jan 7, 2021
  17. laanwj added the label Refactoring on Jan 7, 2021
  18. ajtowns commented at 2:33 PM on January 9, 2021: member

    The UniValue changes are failing to compile; I don't think it has a constructor that could serve as a replacement for push_back.

  19. fanquake commented at 6:22 AM on January 10, 2021: member

    Thanks @SamuelMarks, however I'm going to close this. As mentioned, if you're going to open optimization PRs, you should present some sort of benchmark. PRs that do repository wide refactoring, are also likely to disrupt other work. Regardless of any of that, these changes don't actually compile.

    If you're planning on submitting more PRs, I'd suggest taking a look through CONTRIBUTING.md; then you can also avoid running into other issues, like modifying subtrees.

  20. fanquake closed this on Jan 10, 2021

  21. 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-22 06:14 UTC

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