Skip to content

CI perf: coverage — cargo llvm-cov report runs twice over the same profiles (~2.5 min/run, ~530 job-min/day) #1174

Description

Measurement

  • In the coverage job of merge_group run 37828932401, the step "Run tests with coverage" takes 15.8 min.
    • The instrumented compile plus tests ends at about 13.3 min.
    • It then runs cargo llvm-cov report --lcov (78 s), followed by cargo llvm-cov report --summary-only (74 s).
  • Across 7 days, coverage takes p50 12.5 min and p90 15.1 min (n=950 jobs).
  • Since 2026-10-08 02:16Z, about 427 CI runs per day include coverage:
    • 287 pull_request
    • 105 merge_group
    • 35 push

Where the time goes

.github/workflows/ci.yml, at about lines 536–539:

cargo llvm-cov --workspace --no-fail-fast ...
cargo llvm-cov report --lcov --output-path coverage-host.lcov
cargo llvm-cov report --summary-only | tee coverage-summary.txt

Each report call merges the .profraw files with llvm-profdata and walks every instrumented object. The two calls do the same work.

Root cause

The summary is produced by a second full report pass. It is not derived from the lcov output that was just written.

Proposed fix

Pick one of these:

  • (a) Run both report invocations concurrently, using & and wait. This cuts wall time by about 75 s but saves no CPU.
  • (b) Preferred: emit lcov once and compute the per-file summary table from coverage-host.lcov. The LF/LH/BRF/BRH/FNF/FNH records hold the line, branch and function totals. A small Python helper in scripts/ can render the same fenced table the next step prints.

Keep coverage-summary.txt in the same format so that coverage-merge and the step summary don't change.

Expected saving

  • With (b): about 1.25 min of job time per run, which is about 530 Linux job-min per day.
  • coverage wall time drops by about 1.3 min.
  • Critical path: about 0. coverage finishes before the Gradle e2e legs, and in the last 37 green merge_group runs it was never the job that gated ci-ok.

Coverage and risk

  • Test execution is unchanged; only the reporting changes.
  • Risk: summary numbers could drift from llvm-cov's own summary. Diff the two outputs on one run before switching.
  • The required checks ci-ok and clippy are unchanged.

Effort

S

ROI

ROI = weighted saving × confidence / effort.

  • Weighted saving: 0.53k Linux job-min per day.
  • Confidence: 0.8. Effort: S, which counts as 1.
  • ROI = 0.53 × 0.8 / 1 = 0.42

Activity

  1. mikolalysenko commented on Oct 8, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Triaged as priority:p3 (CI-only). No open PR references this yet; it is not a duplicate of the other CI-perf reports (#1170–#1178 each target a different workflow cost).


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions