Skip to content

ci(perf): publish paired link-time and peak-RSS comparisons for Linux ELF linkers #103

Closed

Description

@zackees

Context

The current benchmark surfaces cannot support a strong competitive linker claim:

  • benchmark-stats.yml is a useful three-platform trend chart, but its Linux comparator installs float, it runs only three wall-time trials, and its public schema discards raw samples/order and contains no memory metric.
  • perf(elf): make OutputSectionPartMap sparse and add pinned Clang link replay #101/perf(elf): make output-section part maps sparse #102 added a pinned LLVM/Clang final-link corpus plus a four-artifact reld baseline/candidate identity gate, but clang-link-replay.yml deliberately times only the candidate. The completed hosted run therefore proved correctness and 30 seconds of candidate replay, not baseline or cross-linker speedup.
  • GNU /usr/bin/time %M is not a valid common peak-RSS collector here. Empirically, the same byte-identical reld link reported about 8.8 MiB in default fork mode versus 102–106 MiB with --no-fork; mold similarly reported about 8.6 MiB while a per-trial cgroup observed about 292 MiB. Parent-only accounting can make a linker look hundreds of MiB leaner than it is.

The existing frozen LLVM/Clang llvmorg-22.1.8 corpus is suitable for a Linux competitive replay: its 73,413,916-byte archive is SHA-256 locked, contains 122 link inputs including 96 static archives/2,469 members, and excludes compilation from replay. A round-two diagnostic linked it successfully with bfd, LLD, mold, Wild, and reld; every contender was self-deterministic and passed the exact native clang -cc1 oracle with empty stdout/stderr.

Three non-interleaved directional trials—not publishable evidence—showed enough separation to justify the work:

Linker Median wall Per-trial cgroup memory peak
bfd 2.40 3.57 s 983 MiB
LLD 14.0.6 0.59 s 357 MiB
mold 2.41.0 0.27 s 292 MiB
Wild 0.9.0 0.13 s 239 MiB
reld baseline 0.15 s 241 MiB

These versions and measurements are calibration only. Publication must repeat with the project’s exact pinned comparator artifacts and the full methodology below.

Proposal

Add a Linux-only, correctness-gated competitive replay around ci/clang-link-corpus.lock.json. Keep the existing cross-platform trend chart and candidate-only profiling replay, but do not use either as competitive evidence.

1. Contenders and immutable operation

Replay the same frozen final-link closure with this fixed display order:

  1. pinned GNU bfd;
  2. pinned LLD;
  3. pinned mold;
  4. pinned Wild;
  5. exact pre-change reld baseline;
  6. checked-out reld candidate.

Build baseline and candidate from non-git source archives under the same pinned Rust/container/toolchain so their version provenance is identical. PR runs use the immutable PR base SHA; manual dispatch requires a full immutable baseline_sha and rejects a branch or abbreviated revision.

Add a checked comparator lock containing immutable release URLs, archive SHA-256, extracted binary SHA-256, exact version output, and the exact direct command recipe for every external linker. Reuse the project’s existing pinned linker provisioning where it meets this contract. Floating apt, Homebrew, Cargo, or PATH-selected comparator versions cannot produce accepted evidence.

The corpus recipe becomes a per-linker semantic recipe. All contenders receive the same output path, response-file inputs, cwd, locale, and allowlisted environment. Remove only unsupported execution-control flags such as reld/Wild’s --no-fork from bfd/LLD; record every resulting argv. Compilation, download, extraction, output cleanup, hashing, native execution, rendering, and report writing remain outside timed intervals.

2. Correctness before measurement

Before timing:

  • Run exact-baseline reld twice and candidate reld twice at the same effective output path. Require raw identity across all four outputs; on mismatch retain all files, SHA-256 values, and first differing byte offset, then emit no performance claim.
  • Run every external contender twice. Require per-contender self-determinism and the exact native Clang exit/stdout/stderr oracle. Do not require raw equality across unrelated linkers because their ELF layout policies differ.
  • Require every timed output to match that contender’s established deterministic artifact hash and pass the native oracle after the timer stops.
  • Record the known Wild/reld policy relationship honestly. The current corpus shows a deterministic build-ID/note-layout delta beginning at byte 129; either restore inherited byte identity or declare and structurally test the intentional ELF policy difference under DESIGN.md §3.1 before citing Wild as an inherited reference.

3. Wall time and peak RSS as co-primary metrics

Measure the complete direct linker transaction in a fresh per-trial cgroup-v2 subtree.

  • Wall time starts immediately before process creation and stops after the complete linker process tree exits.
  • Peak RSS is the maximum summed VmRSS for every PID in that trial’s cgroup, sampled by a monitor outside the timed cgroup. Validate the collector with a helper process tree that allocates and holds a known resident amount.
  • Also record cgroup-v2 memory.peak and cpu.stat deltas as exact whole-tree diagnostics and as a guard against a missed RSS peak. Do not label memory.peak itself as RSS.
  • Reject the run if cgroup-v2 delegation, PID membership, RSS sampling, or cleanup cannot be proven. Never fall back silently to parent-only GNU-time or getrusage data.

Keep default reld fork behavior as the product metric. A --no-fork engine diagnostic may be recorded only as a separately labelled cell and must never replace or aggregate with the default result.

Run two excluded warmups followed by at least ten deterministic seeded, rotated/interleaved measured rounds. Preserve round, position, order, wall seconds, peak RSS KiB, cgroup peak bytes, CPU use, output hash, and metric backend for every sample. Report raw samples, median, MAD, min/max, and deterministic paired-bootstrap 95% confidence intervals for candidate versus baseline and every external contender. Wall and RSS remain independent; do not combine them into a weighted score.

4. Required double graph and evidence surfaces

For each workload, render one aligned paired-bar visualization:

  • left panel/bar: median final-link wall time in seconds;
  • right panel/bar: median peak process-tree RSS in MiB;
  • identical contender order, labels, colors, and grouping in both panels;
  • independent zero-based, clearly labelled linear scales;
  • exact median value/unit and 95% confidence interval printed beside every bar.

Do not normalize seconds and MiB onto one axis, sort only by the winning metric, or emit a scalar “performance score.” A textual claim must state wall and RSS outcomes independently. An aggregate “better” claim is permitted only when the declared confidence rule passes for both metrics; a speed-only claim must display the RSS result beside it.

Publish matching data through:

  • a schema-versioned report JSON;
  • raw sample JSONL;
  • accessible HTML/data table;
  • a PNG containing both aligned panels;
  • the Actions job summary with the same wall/RSS values and links to the evidence bundle.

JSON, HTML, PNG labels, and the job summary must be generated from one report model and tested for parity.

5. Workflow behavior

Add a dedicated Linux competitive-evidence workflow:

  • pull_request: runs for Linux performance work and uses the exact PR base SHA;
  • workflow_dispatch: requires baseline_sha and never mutates published history;
  • no automatic merge gate for unrelated PRs;
  • direct ubuntu-24.04 VM execution, not a job container, because cgroup delegation must be preflighted explicitly;
  • pinned Actions/toolchain/comparator inputs;
  • always upload compact reports/provenance; upload full mismatch artifacts only on failure, with bounded retention.

Hosted-runner results support paired same-run claims only. Record runner image, kernel, CPU model/count, cpuset/affinity, memory, filesystem/mount, load/pressure, tool hashes/versions, source trees, corpus/lock hashes, exact commands, and sanitized environment. Do not infer a cross-date speedup from different hosted machines.

Acceptance criteria

  • RED: a one-byte fake candidate delta fails the four-run reld identity gate; GREEN retains all four artifacts/hashes plus the exact first differing offset and blocks timing/claim output.
  • RED: a fake external comparator that changes across its two setup runs fails self-determinism; GREEN accepts a self-identical comparator without requiring cross-linker byte equality.
  • RED: changed input hashes, response files, output path, cwd, or allowlisted environment fail operation-equivalence validation; GREEN records an identical effective operation except for the declared linker executable/recipe.
  • RED: a floating comparator URL/version, missing archive or binary checksum, changed version output, or non-full manual baseline SHA fails lock validation; GREEN records verified immutable provenance.
  • RED: parent-only RSS accounting reports the known forked helper incorrectly; GREEN uses a unique cgroup and a validated process-tree RSS collector that observes the known held resident allocation within a declared tolerance.
  • RED: missing/malformed wall, RSS, cgroup peak, CPU, round, position, order, backend, or output hash fails sample validation; GREEN emits one unit-labelled record per replay.
  • RED: fewer than two warmups/ten measured rounds, unbalanced ordering, mismatched pairs, or missing raw samples fails; GREEN produces seeded interleaved evidence plus medians/MAD and paired-bootstrap 95% intervals.
  • RED: a wall improvement accompanied by an RSS regression cannot render an aggregate “better” claim; GREEN reports both independent decisions and intervals.
  • RED: a renderer fixture with mismatched contender order, shared time/RSS scale, missing unit/value/CI, or scalar combined score fails; GREEN renders the required aligned paired bars.
  • RED: JSON/HTML/PNG/job-summary parity fails when either metric is absent or disagrees; GREEN proves every surface exposes the same time/RSS values.
  • All five external/current contenders plus the exact reld baseline complete the frozen Clang link, are self-deterministic, and pass exact native output; baseline/candidate raw identity and every timed-output hash/oracle gate pass before a claim.
  • Repeat the calibration with the final pinned bfd/LLD/mold/Wild artifacts, attach the raw report and double graph, and state what the data does and does not prove.
  • Focused Python/workflow tests run RED→GREEN. No Cargo manifest, lockfile, dependency baseline, or new crate dependency changes are permitted.
  • Update agents/platforms/linux.md; update the other platform guides only if shared behavior or validation commands change.

Decisions

  • Use the existing Clang corpus for v1. It is already immutable, archive-heavy, realistic, natively runnable, and verified across all five ELF linkers; a second large corpus would add maintenance before the measurement contract is trustworthy.
  • Add a separate competitive-evidence workflow. The public cross-platform chart remains useful trend context, while perf(elf): make output-section part maps sparse #102’s replay remains a correctness/profile tool. Neither is silently redefined.
  • Measure default product behavior. Reld’s normal fork is included; --no-fork is diagnostic only.
  • Validate RSS instead of relabelling cgroup memory. Cgroup membership scopes the process tree, summed VmRSS supplies the displayed RSS, and memory.peak remains an independently named diagnostic.
  • Keep wall and RSS co-primary. The double graph has separate scales and no composite score.
  • Make same-run comparisons authoritative. Ephemeral hosted hardware is recorded and paired within a run; history is transparency, not cross-machine inference.
  • Keep v1 Linux-only. Native ELF is the competitive engine today. Windows/macOS remain bridge-mode trend charts and are not included in native-linker claims.

Related issues

Activity

  1. zackees commented on Sep 1, 2026

    @zackees
    CollaboratorAuthor

    Hosted evidence is now available from the corrected renderer run:

    The run passed live cgroup-v2 RSS calibration, exact pre-change reld artifact identity, external self-determinism/native execution, all per-trial output gates, two warmups, and 12 measured rounds in two seeded Williams blocks.

    Candidate medians:

    • 0.242 s wall link time
    • 529.973 MiB peak process-tree RSS

    Paired bootstrap 95% intervals show candidate improvements versus:

    • GNU bfd: wall +92.9% to +93.0%; RSS +40.7% to +40.9%
    • LLD: wall +39.4% to +41.4%; RSS +29.6% to +29.8%
    • mold: wall +11.0% to +12.4%; RSS +30.1% to +30.5%
    • Wild: wall +2.7% to +4.2%; RSS -0.2% to +0.1% (RSS tie; no two-metric superiority claim)
    • exact pre-change reld baseline: wall -0.9% to +0.4%; RSS -0.1% to +0.2% (no measurable candidate change)

    Conclusion: this proves clear time-and-RSS advantages over bfd, LLD, and mold on the frozen LLVM/Clang final-link corpus. It does not prove that reld is way better than Wild, nor that this candidate materially improves on its own baseline. README wording in PR #104 now says exactly that.

  2. zackees commented on Sep 1, 2026

    @zackees
    CollaboratorAuthor

    Final status: PR #104 merged to main as f66188fbc72c5af991ac6e93bea5c1af88b057b0 and the README now embeds the permanent paired graph and its exact release-backed measurements.

    The exact final PR head also completed an independent hosted replay: https://github.com/zackees/reld/actions/runs/33465580936. Despite higher shared-runner load, it reproduced the same conclusion: two-metric wins over bfd/LLD/mold, a small wall-time win but RSS tie versus Wild, and no measurable change versus the exact pre-change reld baseline.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions