Skip to content

Commit Cargo.lock so benchmarks aren't subject to dependency drift - #265

Merged
samuelcolvin merged 6 commits into
mainfrom
commit-cargo-lock
Aug 18, 2026
Merged

samuelcolvin merged 6 commits into
mainfrom
commit-cargo-lock

Conversation

@samuelcolvin

@samuelcolvin samuelcolvin commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

The bench job resolves dependencies fresh on every run, so a CodSpeed comparison spans whatever dependency releases happened between the base run and the head run. On #264 that produced three regressions caused by num-bigint moving 0.4.6 -> 0.4.8 between a June base run and an August head run, rather than by anything in the diff.

Committing the root Cargo.lock fixes the dependency graph, so a benchmark comparison only reflects the diff.

Expect one re-baseline on this PR. The committed lockfile is a fresh resolve, so it pins num-bigint 0.4.8. The working tree's old lockfile pinned 0.4.6, but lockfiles don't apply to dependents, so 0.4.8 is what cargo add jiter resolves today; benchmarking 0.4.6 would measure a version no user gets. CodSpeed should show massive_ints_array_jiter_iter and massive_ints_array_jiter_value regressing once, then stay stable.

That regression is real and upstream: BigDigits::push allocates capacity exactly 2 when a BigUint spills to the heap, where pre-0.4.7 it got 4 from Vec::push. Fix proposed in rust-num/num-bigint#355; when it lands we bump and get the time back.

test-latest-deps deletes Cargo.lock before cargo test, so dependencies resolve fresh the way they do for anyone adding jiter to their project, and a breaking dependency release still fails CI. It's in the check gate.

crates/jiter-python/Cargo.lock stays ignored: it's a maturin build artifact, and jiter-python is a workspace member covered by the root lockfile.

The bench job resolved dependencies fresh on every run, so a benchmark
comparison spanned whatever dependency releases happened between the
base run and the head run. On #264 that showed up as three regressions
caused by num-bigint moving 0.4.6 -> 0.4.8, not by the diff.

Committing the root lockfile fixes the dependency graph for benchmarks.
The lockfile is a fresh resolve, so it pins num-bigint 0.4.8, the version
`cargo add jiter` resolves today; benchmarks re-baseline once against it
rather than measuring a version no user gets.

test-latest-deps runs `cargo update` before `cargo test`, so a breaking
dependency release still fails CI. The lint job now runs `cargo metadata
--locked`, which fails when Cargo.toml changes without refreshing the
lockfile.

crates/jiter-python/Cargo.lock stays ignored; it is a maturin artifact
and jiter-python is a workspace member.
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 15.66%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 3 (👁 3) regressed benchmarks
✅ 67 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
👁 massive_ints_array_jiter_iter 564.1 µs 685 µs -17.65%
👁 massive_ints_array_jiter_value 743 µs 849.6 µs -12.55%
👁 python_parse_massive_ints_array 1.1 ms 1.4 ms -16.71%

Comparing commit-cargo-lock (b4d5802) with main (785cf75)

Open in CodSpeed

Comment thread .github/workflows/ci.yml
`cargo metadata --locked` ran after `cargo doc`, and after pre-commit's
cargo fmt/clippy/check hooks, any of which regenerates a stale lockfile
first, so the check passed regardless. Placing it before all of them is
possible but not worth the ordering constraint.

test-latest-deps still covers dependency breakage.
The `**/Cargo.lock` plus `!/Cargo.lock` pair only existed to carve out
the root lockfile. Dropping both is equivalent: the lockfiles under
profiling/, scratch/ and scratch-project/ are already covered by the
directory rules above.
Both produce a byte-identical lockfile here, but deleting it is what
happens for anyone adding jiter to their project, so it says what the job
is for without the reader having to know cargo update's semantics.
The nightly test job failed in `cargo llvm-cov` with "failed to collect
object files ... target/llvm-cov-target/debug". rustc 1.100.0-nightly
(2026-08-17) uses Cargo's new build-dir layout, which cargo-llvm-cov
0.8.5 does not know about, so it looks for object files where there are
none. 0.9.0 handles the new layout.

install-action resolves `cargo-llvm-cov` from a manifest baked into its
release: v2.71.3 (April) pins latest to 0.8.5, v2.86.3 pins it to 0.9.0.

Reproduced on rustc 1.100.0-nightly (8fa1c96cf 2026-08-17): 0.8.5 fails
with that error, 0.9.0 writes a valid codecov.json.

This break is not from committing Cargo.lock; it also fails on main and
on #264.
@samuelcolvin
samuelcolvin merged commit ced827c into main Aug 18, 2026
54 of 55 checks passed
@samuelcolvin
samuelcolvin deleted the commit-cargo-lock branch August 18, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant