Skip to content

build(libobs): record the libobs build phases for the module-cache baseline (#3257) - #3294

Merged
zackees merged 3 commits into
masterfrom
build/3257-libobs-baseline
Oct 31, 2026
Merged

zackees merged 3 commits into
masterfrom
build/3257-libobs-baseline

Conversation

@zackees

@zackees zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member

What

  • rust/tools/benchmarks/libobs_build_phases.py (uv script) configures a libobs-only tree, builds it cold, then for each edit case appends an inert change to one tracked file, rebuilds, and restores the file byte for byte. The cases are no change, libobs/obs.c.h, libobs/build/libobs.pch.h, a ported-source-set .json, and rust/obs-util/src/lib.rs. Each sample records:

    • wall and CPU time;
    • every .ninja_log entry the build appended, attributed to its unity group, the libobs link or the Corrosion/cargo step;
    • zccache counter deltas;
    • the obs-c-oracle build time.

    --oracle-only covers a host without the libobs C deps; --no-oracle covers the container. Every build(libobs): tracker — decentralized lib-modules in a content-addressed artifact cache, relinked into libobs #3256 sibling reruns this script for its "after" numbers.

  • docs/rust-port/benchmarks/libobs-modules-baseline.json: 3 samples per case.

Baseline (Linux, medians; Ryzen 7 3700X, load average 10-20)

case wall C groups compiled compile CPU Rust step oracle rebuild
configure 14.9 s
cold 23.3 s 11 25.0 s 43.2 s 365 s (cold, host)
no change 0.37 s 0 0 0.56 s 3.0 s
one .c.h 3.9 s 1 3.4 s 0.2 s 3.7 s
libobs.pch.h 8.0 s 4 16.6 s 0.7 s 3.3 s
ported .json 0.17 s 0 0 0.3 s 3.5 s
Rust crate 9.2 s 0 0 17.5 s 1.7 s

What it says for #3256

Not covered

RED → GREEN

  • RED (first commit): ci/test_libobs_build_phases.py fails with no recorder.
  • GREEN: five tests pass (ninja-log offset and parsing, group/link/Rust attribution, the case table names tracked files, byte-exact revert), and ./lint passes.

Test cost: five Python tests, about 1 ms, no threads.

Refs #3257. Refs #3256.

@zackees
zackees enabled auto-merge October 31, 2026 22:14

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review. One real finding, plus one cleanup.

  1. The cold oracle number comes from a failed build. In docs/rust-port/benchmarks/libobs-modules-baseline.json, initial_oracle has "returncode": 101 and a stderr_tail that ends in soldr: pruned 253 orphan .rmeta file(s) ... after failed cargo build. The PR body's "365 s (cold, host)" oracle figure is that sample's wall time, so it measures a build that failed partway, not a cold oracle build. Either rerun until it exits 0, or drop the number and mark it unmeasured. Also make the script fail, or at least mark a sample "ok": false and leave it out of the medians, when any timed command exits non-zero. The soldr cargo build -p obs-c-oracle call is subprocess.run(...) with no check, so a broken build gets recorded as a timing. (The per-case oracle samples I spot-checked all show returncode: 0.)
  2. Local paths are committed. The same stderr_tail contains absolute paths under /home/<user>/dev/obs-rust/obs-studio3/ and ~/.soldr/. Once the failed sample is gone this goes too. Otherwise, store at most the tail's last line, with paths made relative to the repo root.

The rest is sound. Restoring the edited file byte for byte in finally, and doing an untimed rebuild between samples, keeps the tree clean and the samples independent. The conclusions for #3256 follow from the other cases: the Rust staticlib dominates, which makes #3265 the biggest win, and the PCH edit recompiles 4 of 11 groups. They don't depend on the bad oracle number.

@zackees

zackees commented Oct 31, 2026

Copy link
Copy Markdown
Member Author

Coordinator: the Fast Gate failure is in this PR's own code. Ruff C901 reports main as too complex (12 > 10) at rust/tools/benchmarks/libobs_build_phases.py:225 (job https://github.com/obs-rust/obs-studio/actions/runs/41247285269/job/124673464273). That's a refactor rather than a mechanical fixup, and it overlaps the failed-sample handling from my review. Splitting main into run_cold/run_cases/run_oracle, with the non-zero-return check in a shared helper, would clear both. Leaving it to you.

@zackees
zackees added this pull request to the merge queue Oct 31, 2026
Merged via the queue into master with commit ed2e5b9 Oct 31, 2026
35 checks passed
@zackees
zackees deleted the build/3257-libobs-baseline branch October 31, 2026 23:07
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Needs fix to Done in obs-rust Multiview Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant