build: Remove unused C++ standard library includes #16238

pull practicalswift wants to merge 2 commits into bitcoin:master from practicalswift:c++-standard-library-headers changing 90 files +17 −135
  1. practicalswift commented at 10:43 pm on June 18, 2019: contributor

    Reduce accumulated max memory usage (RSS) during build by ~1% (-838 MB) by not including unused C++ standard library headers.

    This is a follow-up to now merged #16129 which reduced the memory usage by ~2% (-2632 MB).

    Comparing max memory usage (RSS) between old revision 44d81723236114f9370f386f3b3310477a6dde43 (branch master) and new revision 50f005631f053f2531738f574d4363378b69a5fc (branch c++-standard-library-headers):

    File Old New Diff Percent
    bench/bench_bench_bitcoin-bench_bitcoin.o 236 MB 218 MB -18 MB -8 %
    libbitcoin_common_a-netbase.o 281 MB 263 MB -18 MB -6 %
    libbitcoin_common_a-protocol.o 236 MB 218 MB -18 MB -7 %
    libbitcoin_common_a-warnings.o 212 MB 195 MB -17 MB -8 %
    libbitcoin_server_a-addrman.o 286 MB 270 MB -17 MB -6 %
    libbitcoin_server_a-banman.o 253 MB 235 MB -18 MB -7 %
    libbitcoin_server_a-dbwrapper.o 287 MB 269 MB -18 MB -6 %
    libbitcoin_server_a-flatfile.o 239 MB 221 MB -18 MB -8 %
    libbitcoin_server_a-timedata.o 256 MB 239 MB -17 MB -7 %
    libbitcoin_util_a-chainparamsbase.o 225 MB 208 MB -17 MB -8 %
    rpc/libbitcoin_cli_a-client.o 263 MB 246 MB -17 MB -6 %
    rpc/libbitcoin_util_a-protocol.o 258 MB 240 MB -18 MB -7 %
    util/libbitcoin_util_a-error.o 220 MB 202 MB -17 MB -8 %
    util/libbitcoin_util_a-threadnames.o 69 MB 48 MB -21 MB -31 %
    wallet/libbitcoin_wallet_a-walletutil.o 249 MB 232 MB -17 MB -7 %
    … suppressing 438 unchanged measurements …
    Average (N=453) 319 MB 317 MB -2 MB -1 %
    Sum (N=453) 144380 MB 143542 MB -838 MB -1 %

    Measured using:

    0$ g++ --version
    1g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
    

    Please note that the removed headers are not removable by being “transitively included” by other still included headers. Thus the removals are real. (In other words: the naïve and totally pointless “remove as long as it compiles” method to include “reduction” has not be used.)

  2. DrahtBot added the label Build system on Jun 18, 2019
  3. DrahtBot added the label Consensus on Jun 18, 2019
  4. DrahtBot added the label GUI on Jun 18, 2019
  5. DrahtBot added the label Mempool on Jun 18, 2019
  6. DrahtBot added the label Mining on Jun 18, 2019
  7. DrahtBot added the label RPC/REST/ZMQ on Jun 18, 2019
  8. DrahtBot added the label Tests on Jun 18, 2019
  9. DrahtBot added the label Utils/log/libs on Jun 18, 2019
  10. DrahtBot added the label UTXO Db and Indexes on Jun 18, 2019
  11. DrahtBot added the label Validation on Jun 18, 2019
  12. DrahtBot added the label Wallet on Jun 18, 2019
  13. fanquake removed the label Build system on Jun 18, 2019
  14. fanquake removed the label Consensus on Jun 18, 2019
  15. fanquake removed the label GUI on Jun 18, 2019
  16. fanquake removed the label Mempool on Jun 18, 2019
  17. fanquake removed the label Mining on Jun 18, 2019
  18. fanquake removed the label RPC/REST/ZMQ on Jun 18, 2019
  19. fanquake removed the label Tests on Jun 18, 2019
  20. fanquake removed the label UTXO Db and Indexes on Jun 18, 2019
  21. fanquake removed the label Utils/log/libs on Jun 18, 2019
  22. fanquake removed the label Validation on Jun 18, 2019
  23. fanquake removed the label Wallet on Jun 18, 2019
  24. fanquake added the label Refactoring on Jun 18, 2019
  25. DrahtBot commented at 1:22 am on June 19, 2019: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16224 (gui: Bilingual GUI error messages by hebasto)
    • #15935 (WIP: Add /settings.json persistent settings storage by ryanofsky)
    • #15934 (Separate settings merging from parsing by ryanofsky)
    • #14193 (validation: Add missing mempool locks by MarcoFalke)
    • #13686 (ZMQ: Small cleanups in the ZMQ code by domob1812)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  26. practicalswift force-pushed on Jun 19, 2019
  27. build: Reduce memory usage during build by not including unused C++ standard library headers 2f96c5e2d8
  28. practicalswift force-pushed on Jun 19, 2019
  29. practicalswift renamed this:
    build: Reduce accumulated max memory usage (RSS) during build by 1% (-800 MB) by not including unused C++ standard library headers
    build: Reduce accumulated max memory usage (RSS) during build by 1% (-838 MB) by not including unused C++ standard library headers
    on Jun 19, 2019
  30. practicalswift force-pushed on Jun 19, 2019
  31. build: Reduce memory usage during build by not including unused C compatibility headers 08bdbdce93
  32. practicalswift force-pushed on Jun 19, 2019
  33. promag commented at 3:43 pm on June 19, 2019: member

    Please note that the removed headers are not “unused” in these files by being transitively included by other still included headers.

    I don’t get it, if the removed headers are used (transitively included) where comes the reduction?

    Or you mean that just some of the removed are transitively included?

  34. practicalswift commented at 10:11 pm on June 19, 2019: contributor

    Please note that the removed headers are not “unused” in these files by being transitively included by other still included headers.

    I don’t get it, if the removed headers are used (transitively included) where comes the reduction?

    Or you mean that just some of the removed are transitively included?

    Sorry for the sloppy wording.

    What I meant to say is that if an #include is removed in this PR it is because the included header was not used:

    If #include <foo.h> could be removed from bar.cpp it was because foo.h was unused in bar.cpp (no symbol or type from foo.h used in bar.cpp), and not due to the fact that foo.h was still being included after the removal but now instead indirectly via another still present inclusion (say header_including_foo.h) in bar.cpp.

    In other words: the naïve and totally pointless “remove as long as it compiles” method to include “reduction” has not be used.

    Are you following? :-)

  35. MarcoFalke renamed this:
    build: Reduce accumulated max memory usage (RSS) during build by 1% (-838 MB) by not including unused C++ standard library headers
    build: Remove unused C++ standard library includes
    on Jun 20, 2019
  36. practicalswift closed this on Jun 23, 2019

  37. practicalswift deleted the branch on Apr 10, 2021
  38. 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: 2024-11-17 15:12 UTC

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