Skip to content

tools: measure the % of OBS converted to Rust and show it as an SVG in README.md #2242

Closed

Description

@zackees

Goal

A script that measures how much of OBS has been converted to Rust, run by the site build, which renders the result as an SVG shown in README.md. The agent that implements this decides where in the README it goes.

Why

Nothing in the repo measures this today. Counting lines in the tree is misleading: the original C stays in the repo for the libobs-c-reference build and as Tier 3 oracle copies, and each port adds extraction files and shims, so C line counts go up as ports land. Counting rust-exports.map entries against EXPORT declarations (~236 / 1,865 ≈ 13%) undercounts too, because most ports move logic inside an exported function rather than the whole function.

The hybrid build is the honest measure. On origin/master today the libobs/build/libobs.ported-*+.h.c groups take 214 libobs source files (~34.4k lines) out of the hybrid build, of ~79k lines of libobs implementation C (~44%).

The script

tools/conversion/measure.py (runs through uv run), output JSON plus the SVG:

  1. libobs: lines of C/C++/ObjC implementation (.c, .c.h, .m, .m.h, .cpp) that the hybrid libobs build compiles, versus the same set in the C reference build. Ported = files included only through libobs.ported-* groups. Read the groups the way rust/tools/ported_sources.py does, so the count and the Tier 2 check share one definition. Report per host (linux, windows, macos) and per area (util, media-io, graphics, core).
  2. Whole app: the same ratio over libobs + frontend + plugins + shared + deps, with plugins/obs-websocket excluded (it stays C++ by policy) and listed separately as "kept by design".
  3. Exclude from every count: rust/obs-c-oracle/legacy/, tests (test/, rust/*/tests/), generated files, third-party code under deps/ that is vendored rather than ours (list the exclusions in the script).
  4. Rust lines (non-test, non-oracle) as a secondary number, not the headline.
  5. Deterministic: same tree, same numbers. A --check mode for CI.

Headline numbers in the SVG: libobs % converted and whole app % converted, with the date and commit.

Site build

Add a step to .github/workflows/leaderboard.yml (the site build: it commits to the leaderboard branch served by GitHub Pages) that runs the script and commits conversion.svg + conversion.json next to leaderboard.jpg. README.md embeds the SVG from that branch, like the leaderboard image. No new workflow file.

Tests

  • RED: a ci test with a fixture tree (two ported groups, an oracle copy, a test file, a websocket file) asserting the exact counts and that exclusions are excluded.
  • GREEN: the script; a test that the real tree's libobs number matches the Tier 2 ported-object list from rust/tools/ported_sources.py.
  • The SVG renders with text (not an image), so it stays a vector and is readable in both themes.

Done when

The README shows the SVG with both percentages, the leaderboard run updates it, and the numbers match a manual count on one commit (state the commit in the PR).

Activity

  1. added
    enhancement
    on Oct 24, 2026
  2. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: #2242, using the plan in the issue. Script at tools/conversion/measure.py, with a RED fixture-tree test first. It runs as a step in leaderboard.yml (no new workflow file), and the README embeds the SVG from the leaderboard branch.

  3. added
    claimed
    on Oct 24, 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

    claimedenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions