Skip to content

build(libobs): cache the Rust staticlib as a module and drop needless Corrosion serialisation #3265

Closed

Description

@zackees

Scope

Treat libobs_rust-static as one more cached module, keyed on Cargo.lock, the rustc version and the sources of the linked crates (the linked_crates set in ci_scope.py). Remove obs_serialize_cargo_build stalls where they are not needed.

Acceptance criteria

The hybrid warm-rebuild wall time drops from 6.0 s to under 2 s.

RED then GREEN where a check applies; record before and after build times. Parent: #3256.

Activity

  1. added
    infra
    P3
    size:M
    on Oct 31, 2026
  2. zackees commented on Oct 31, 2026

    @zackees
    MemberAuthor

    /investigate
    Blocked by #3262 (it reuses the module key and cache to store the Rust staticlib) and #3257 (the 6.0 s to under 2 s criterion needs the baseline). The Corrosion-serialisation half could be split out and started now if someone wants it early.

  3. added
    needs-investigation
    on Oct 31, 2026
  4. zackees commented on Nov 1, 2026

    @zackees
    MemberAuthor

    Claiming: #3265, stacked on #3321 (the module cache).

    Plan, one PR:

    1. RED: tests that the Rust staticlib's key changes with a linked crate's source, Cargo.lock, the features and the toolchain, and does not change for a crate libobs-rust does not link.
    2. GREEN:
      • rust.cmake writes libobs-modcache-rust.json: the archive path, Corrosion's features, the triple, the profile and the C compiler.
      • ci/libobs_modules.py keys the staticlib on that json, Cargo.lock, rust-toolchain.toml, rustc -vV, RUSTFLAGS, gio's pkg-config version, and every file of the path crates libobs-rust depends on (from cargo metadata), plus the two files outside those crates that their build scripts read (libobs/obs-hotkeys.h, the vendored jansson headers).
      • On a hit, libobs links a cached IMPORTED archive with Corrosion's link libraries and options, and the cargo build target leaves the build.
    3. Before and after times: a fresh build dir with a warm cache, and a C-only edit.
  5. github-actions commented on Nov 1, 2026

    @github-actions

    Claim bot: @zackees, this can't be claimed yet: it needs investigation before anyone can implement it. Comment Claiming: investigation to take the research.

  6. zackees commented on Nov 1, 2026

    @zackees
    MemberAuthor

    Done in #3324: the Rust staticlib is cached as a lib-module. A warm cache in a fresh build dir runs 0 compiles and skips cargo (cold 28 s, warm 15 s on Linux); exports are identical. The 6.0 s → <2 s no-op target could not be shown: a no-op rebuild is ~17 ms with or without the cache.

  7. moved this from Investigating to Done in obs-rust Multiviewon Nov 1, 2026
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

    P3infraneeds-investigationsize:M

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions