Repository navigation
Description
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:
- 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 throughlibobs.ported-*groups. Read the groups the wayrust/tools/ported_sources.pydoes, 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). - Whole app: the same ratio over libobs + frontend + plugins + shared + deps, with
plugins/obs-websocketexcluded (it stays C++ by policy) and listed separately as "kept by design". - Exclude from every count:
rust/obs-c-oracle/legacy/, tests (test/,rust/*/tests/), generated files, third-party code underdeps/that is vendored rather than ours (list the exclusions in the script). - Rust lines (non-test, non-oracle) as a secondary number, not the headline.
- Deterministic: same tree, same numbers. A
--checkmode 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).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 24, 2026
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.tools: measure the share of OBS converted to Rust; show it in README.…