ci: drop -f from test compile flags to speed up CI - #16
Closed
chaitanyaprem wants to merge 2 commits into
Closed
Conversation
Each test in `nimble test` and `nimble testComponent` is its own Nim binary, sharing a single nimcache. The `-f` (force recompile) flag was forcing every test to recompile its entire transitive dep tree (libp2p, chronos, stew, nimcrypto, ...) from scratch — the dominant cost of CI. Without `-f`, the first test pays the full compile cost; subsequent tests reuse compiled `.o` files from nimcache. Expected per-job reduction: ~50-70% of the test-phase wall-clock. Safe to drop because: - All test invocations go through `runTest(name)` with the default empty `moreoptions`, so every test compiles with identical `cfg` — nimcache hits will always be flag-correct. - `--styleCheck`, `--opt:speed`, `-d:libp2p_mix_experimental_exit_is_dest` remain in `cfg`; only the recompile-everything bit is gone. If a future test needs different compile flags, pass them via `moreoptions` and pair with `-f` for that specific invocation rather than re-enabling it globally.
nph reflows the last two `&`-joined `cfg` strings onto a single line now that removing `-f` brought the line below the wrap threshold. No functional change.
Collaborator
Author
|
Closing — the Why it didn't work: each CI on this PR vs the prior baseline (PR #14):
Tracked as # for proper investigation (likely fix: explicit |
Collaborator
Author
|
Tracked in #17. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Drops the
-f(force recompile) flag from the sharedcfgused by everyrunTestandbuildExampleinvocation inlibp2p_mix.nimble.Why
Each test in
nimble test/nimble testComponentis its own Nim binary, but they all share a singlenimcache/directory in the working tree. With-fpresent, every test recompiles its entire transitive dep tree (libp2p, chronos, stew, nimcrypto, …) from scratch — the dominant cost of CI.Without
-f, the first test pays the full compile cost; subsequent tests reuse compiled.ofiles fromnimcache. Expected per-job reduction: ~50-70% of the test-phase wall-clock.Baseline (from PR #14's CI run)
Stacked on top of #12 (
chore/bump-libp2p-v2.0.0). Before this change, the test-phase per-job times on a fresh runner were:CI for this PR should show the same number of tests run with substantially lower wall-clock — that's the validation.
Why this is safe
nimble testandnimble testComponentcallrunTest(name)with no per-testmoreoptions. Every test compiles with the samecfg, so nimcache hits will always be flag-correct.--styleCheck:usages,--styleCheck:error,--opt:speed,--threads:on,-d:libp2p_mix_experimental_exit_is_dest. Only the recompile-everything bit is gone.moreoptionsand pair with-ffor that specific invocation rather than re-enabling it globally.Diff
One file, ~9 lines added (most of which is an explanatory comment):
Rollback
If this surfaces flaky behavior in CI (test cross-contamination via stale nimcache), the rollback is a one-character revert — re-add
-fincfg. No downstream impact sincelibp2p_mix.nimble's test config is purely internal to this repo.