Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: hardcode git info for faster incremental Debug builds #2473

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

battlmonstr
Copy link
Contributor

@battlmonstr battlmonstr commented Nov 4, 2024

Problem:

A git commit sha or a branch name change causes relinking of executable targets with silkworm-buildinfo library even if nothing else has changed.

During development (e.g. local Debug builds) it is more important to have fast incremental builds than having the correct git commit sha and a branch name baked into the binary.

Solution:

Add git info arguments to cable_add_buildinfo_library. Hardcode them in Debug builds to avoid relinking and save time when doing small changes and git rebase/squash/reword operations.

Test

Silkworm git commit --amend --date=now && time make output before the change:

...
[11/70] Updating silkworm-buildinfo:
       Project Version:  0.1.0-dev+commit.11e1cbbc.dirty (prerelease)
       System Name:      darwin
       System Processor: arm64
       Compiler ID:      appleclang
       Compiler Version: 15.0.0.15000309
       Build Type:       debug
       Git Info:         //11e1cbbc69056575cae00370af1883e5f6504944 (dirty)
       Git Branch:       pr/test
       Git Origin URL:   [email protected]:erigontech/silkworm.git
       Timestamp:        2024-11-04T10:57:47
[68/69] Linking CXX executable cmd/dev/snapshots
make  104.37s user 9.23s system 509% cpu 22.279 total

Silkworm git commit --amend --date=now && time make output after the change:

...
[1/47] CableBuildInfo: updating gitinfo.txt
make  0.08s user 0.07s system 84% cpu 0.176 total

Note

Our evmone refers to https://github.com/erigontech/evmone - rebase_to_v0.13 branch.

Upstream PR:
ethereum/evmone#1067

Problem:

A git commit sha or a branch name change causes relinking of executable targets with silkworm-buildinfo library even if nothing else has changed.

During development (e.g. local Debug builds) it is more important to have fast incremental builds than having the correct git commit sha and a branch name baked into the binary.

Solution:

Add git info arguments to cable_add_buildinfo_library.
Hardcode them in Debug builds to avoid relinking and save time when doing small changes and git rebase/squash/reword operations.
@battlmonstr battlmonstr requested a review from canepat November 4, 2024 11:10
@canepat canepat added the enhancement New feature or improvement label Nov 4, 2024
@canepat canepat merged commit 90e29ac into master Nov 4, 2024
5 checks passed
@canepat canepat deleted the pr/gitinfo branch November 4, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants