build: Minimize I/O operations in GenerateHeaderFrom{Json,Raw}.cmake #30842

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:240907-scripts changing 2 files +25 −21
  1. hebasto commented at 2:41 pm on September 7, 2024: member

    This PR aims to reduce build time by replacing multiple file(WRITE|APPEND ...) commands with a single file(WRITE ...) command.

    Due to differences in implementation (e.g., filesystem design, system calls, caching), a noticeable improvement in build time is observed only on Windows.

    Additionally, the code has been refactored to remove the remainder local variables.

  2. build: Minimize I/O operations in `GenerateHeaderFrom{Json,Raw}.cmake` b07fe666f2
  3. hebasto added the label Build system on Sep 7, 2024
  4. DrahtBot commented at 2:41 pm on September 7, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sipsorcery, TheCharlatan, maflcko

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  5. TheCharlatan commented at 3:29 pm on September 7, 2024: contributor
    I am not measuring a difference in performance in the generation of the headers between master and this PR.
  6. hebasto commented at 3:53 pm on September 7, 2024: member

    I am not measuring a difference in performance in the generation of the headers between master and this PR.

    Building on Windows benefits most.

  7. DrahtBot added the label CI failed on Sep 7, 2024
  8. hebasto commented at 9:20 am on September 8, 2024: member

    I am not measuring a difference in performance in the generation of the headers between master and this PR.

    Building on Windows benefits most.

    On my Windows machine, the time to process data/*.h headers for the test_bitcoin target has been reduced from ~155s to ~105s. @sipsorcery What do you think?

  9. DrahtBot removed the label CI failed on Sep 8, 2024
  10. DrahtBot added the label CI failed on Sep 8, 2024
  11. sipsorcery commented at 8:04 pm on September 8, 2024: member

    @sipsorcery What do you think?

    The overall build time for me on Win11 msvc reduced by 44s (only one test run each of the master and PR builds).

    master:

    0PS C:\Dev\github\bitcoin>  Measure-Command { cmake --build build --config Release }
    1TotalSeconds      : 637.2643505
    

    pr 30842:

    0PS C:\Dev\github\bitcoin>  Measure-Command { cmake --build build --config Release }
    1TotalSeconds      : 553.3287435
    

    IMHO it’s always beneficial to improve CI times so +1 for me.

    tACK b07fe666f27e2b2515d2cb5a0339512045e64761

  12. TheCharlatan approved
  13. TheCharlatan commented at 8:39 am on September 9, 2024: contributor
    ACK b07fe666f27e2b2515d2cb5a0339512045e64761
  14. fanquake commented at 8:40 am on September 9, 2024: member

    This PR aims to reduce the build time.

    Can you update the PR description to clarify that this is only relevant for native windows builds. Can you also add the explanation for why this only makes a difference on Windows.

  15. hebasto commented at 10:21 am on September 9, 2024: member

    This PR aims to reduce the build time.

    Can you update the PR description to clarify that this is only relevant for native windows builds. Can you also add the explanation for why this only makes a difference on Windows.

    I did my best.

  16. maflcko commented at 7:08 am on September 11, 2024: member

    review ACK b07fe666f27e2b2515d2cb5a0339512045e64761

    Seems fine to always buffer everything in memory twice, because it is already buffered in memory once (as the full hex_content) and the data should be small (generally less than 10 MB?)

  17. maflcko added the label DrahtBot Guix build requested on Sep 11, 2024
  18. DrahtBot commented at 10:41 pm on September 11, 2024: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 0725a374941355349bb4bc8a79dad1affb27d3b9(master) commit 365271a2b83fa3bc0d2eadd654e0473ca99ef7bf(master and this pull)
    SHA256SUMS.part a02d778ecea785cb... 5d00df5a16b033a3...
    *-aarch64-linux-gnu-debug.tar.gz 2f9b090610716543... 55c8db2ac52c5270...
    *-aarch64-linux-gnu.tar.gz cdddc2a011cbc71f... ff736251c8f28ef2...
    *-arm-linux-gnueabihf-debug.tar.gz 3dc368c59f717ba5... 3c8cd613935aa840...
    *-arm-linux-gnueabihf.tar.gz 25130ed715fb51dc... ab43fc3e0f4f6ae5...
    *-arm64-apple-darwin-unsigned.tar.gz af2c8d808c67cf11... 75dec402b6de837a...
    *-arm64-apple-darwin-unsigned.zip f9b25947985c1303... b6210c663685fc98...
    *-arm64-apple-darwin.tar.gz 7511aa736ffea54b... 475285e36e5c9928...
    *-powerpc64-linux-gnu-debug.tar.gz e024d862e1d06449... ca88a93d54ff7e2c...
    *-powerpc64-linux-gnu.tar.gz bd2e78a034cbf626... 59d1be4b7e815f92...
    *-riscv64-linux-gnu-debug.tar.gz b3ee81fe9f44f0e8... 7da77bcf445b0022...
    *-riscv64-linux-gnu.tar.gz 8406605d831d0a39... 242d48776471292b...
    *-x86_64-apple-darwin-unsigned.tar.gz 413c24a042a77e51... b153609052205839...
    *-x86_64-apple-darwin-unsigned.zip 8aa62b3d181cb236... aa336f790df3f651...
    *-x86_64-apple-darwin.tar.gz 92c1741a2626021a... 41a3e65a2e7dbed1...
    *-x86_64-linux-gnu-debug.tar.gz 4f05b270004745fa... 2019fcf1be89c9cf...
    *-x86_64-linux-gnu.tar.gz 5873429dcd6b0d7b... dbce51c273b90b07...
    *.tar.gz 2714f753f68195ae... feb8a776585c9a2e...
    guix_build.log 5c24a7305a189158... 4cfb63a1c9bdb681...
    guix_build.log.diff 50d66625fbb45d2d...
  19. DrahtBot removed the label DrahtBot Guix build requested on Sep 11, 2024
  20. fanquake merged this on Sep 12, 2024
  21. fanquake closed this on Sep 12, 2024

  22. hebasto deleted the branch on Sep 12, 2024
  23. maflcko commented at 11:49 am on September 12, 2024: member

    Not sure why, but for me the command took almost an hour:

    0$ ps -p 816447 --format time,rss,cmd
    1    TIME   RSS CMD
    200:51:12 117640 /usr/bin/cmake -DRAW_SOURCE_PATH=_/src/bench/data/block413567.raw -DHEADER_PATH=_/bld-cmake/src/bench/data/block413567.raw.h -DRAW_NAMESPACE=benchmark::data -P _/cmake/script/GenerateHeaderFromRaw.cmake
    

    Previously it took only a few seconds.

  24. hebasto commented at 11:54 am on September 12, 2024: member

    Not sure why, but for me the command took almost an hour:

    0
    1$ ps -p 816447 --format time,rss,cmd
    2
    3    TIME   RSS CMD
    4
    500:51:12 117640 /usr/bin/cmake -DRAW_SOURCE_PATH=_/src/bench/data/block413567.raw -DHEADER_PATH=_/bld-cmake/src/bench/data/block413567.raw.h -DRAW_NAMESPACE=benchmark::data -P _/cmake/script/GenerateHeaderFromRaw.cmake
    

    Previously it took only a few seconds.

    What’s your system?

  25. fanquake commented at 2:59 pm on September 12, 2024: member
    Opened #30881 to track this, given a second dev has reported performance issues.
  26. HumayunMhmadi changes_requested
  27. HumayunMhmadi commented at 3:46 pm on September 12, 2024: none
  28. fanquake referenced this in commit 07c7c96022 on Sep 12, 2024

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-12-21 15:12 UTC

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