Repository navigation
Description
Part of #1295.
Context
The profiling report exposes a measurement gap that prevents attributing full-app frame loss to Rust. The two diagnostic runs below use llvmpipe under Xvfb, have large render-time variation, and include perf sampling overhead/lost samples. The Rust run had more render/encoder skips, but one such pair cannot establish causation or satisfy the 5% release bound. The shim measurements also ran on a shared host while other CPUs built the application.
Proposal
Produce reproducible release evidence with hardware rendering verified in the OBS log, matched C/Rust build options and target features, a fixed saved scene containing the sources required by release criteria, enough independent interleaved runs for a median/range, and no profiler in the timed control runs. Then capture a separate profile to explain a repeated difference. Validate actual library maps so the default C libobs is never mistaken for the Rust twin.
Acceptance criteria
- Before implementation changes, record the current RED measurement failure: this Xvfb profile cannot prove the hardware release gate. Add a focused check of renderer selection and actual mapped libobs for any benchmark harness change; demonstrate it rejects software rendering or the wrong backend and passes on the intended setup.
- Report independent-run medians/ranges for CPU, frame render time, rendered/output frame counts and render/encoder skips, at the same resolution/fps/encoder settings, with driver, CPU/GPU, source hashes and sample windows. Distinguish within-run observations from independent repetitions.
- Resolve or isolate any repeated Rust/C difference seen here. Enforce the existing <=5% full-app recording regression gate, or seek explicit acceptance of measured user impact in a separate issue. Do not waive the gate based on these diagnostic numbers.
- Preserve both Rust/C modes and record sampled stacks separately from measurements. Keep the existing <=10% shim gate. Rerun noisy tiny-function candidates on quiet release hardware before accepting them as confirmed defects.
Decisions
P2 release-validation task. Software rendering is an intentional consequence of this Xvfb setup and is not filed as a new driver bug. This task is distinct from the NixOS hardware-dependency research in #891 and the experimental harness discussion in #756. The public perf gates remain unchanged. No new GitHub Actions workflow is requested.
Full application profile
Built libobs-with-rust and obs-studio in the existing build_host RelWithDebInfo tree (cmake --build build_host --target libobs-with-rust obs-studio -j 4, pinned to CPUs 0–3). Missing propagated host include paths were supplied through process-scoped CPATH; no source fix was made. C and Rust libobs were selected by LD_LIBRARY_PATH; /proc/PID/maps verified the Rust twin for the ON run and its absence for the C control. Qt 6.11.1 plugin paths were isolated from the desktop's 6.11.2 plugins after an initial environment-related Qt abort. The config and X display were isolated; no desktop capture or microphone source was used.
Workload: Xvfb, 1920×1080 at 30 fps, color and FreeType text sources, x264 veryfast recording to MKV, 3 s warmup followed by a 30 s CPU sampling window and 15 GetStats observations. Recordings started/stopped successfully and processes exited; both logs report one remaining OBS allocation. No leak root cause or performance attribution is established here.
| Run | PID | Observed window | Median reported render ms (observation range) | Render skips / frames during window | Encoder skips / frames during window |
|---|---|---|---|---|---|
| Rust twin | 2806160 | 31.35 s | 37.780 (12.088–52.069) | 116 / 910 | 39 / 951 |
| C control | 2812278 | 31.32 s | 13.395 (11.615–66.577) | 55 / 909 | 0 / 910 |
These are single diagnostic runs, not independent-run medians or a valid default-flip comparison. The log explicitly reports Mesa llvmpipe, despite detecting the RTX 3060. Perf attributes Rust-run sampled cycles to JIT code (54.91%), Mesa libgallium (18.56%), and x264 (16.28%); C control is similar (55.85%, 19.47%, 14.48%). Do not attribute JIT symbols to Rust: these are software-rendering JIT samples. The Rust capture has ~18K cycle samples and 70 lost samples; C ~19K and 82 lost samples, with kernel symbols unavailable. This identifies software rendering as the dominant workload cost and leaves the observed Rust/C frame difference unexplained. Xvfb software rendering is expected here; it does not establish a product driver regression. Hardware-backed repeated recording comparisons without sampling overhead remain necessary before applying the release criteria's 5% gate.
Sampling command for each application PID:
perf record -F 199 -g --call-graph dwarf,16384 -p PID -o perf.data -- sleep 30Measurement context
Measured on 2026-10-17, AMD Ryzen 7 3700X, Linux x86_64, CPU affinity 7, Rust 1.98.1, GCC 15.2.0. Five complete passes of all 70 paired Criterion comparisons; 30 samples/case/pass, 0.1 s warmup, 0.4 s measurement, 10,000 resamples. Values below are medians of the five pass medians. The ratio range contains the five paired Rust/C ratios; the reported median ratio divides the two backend medians.
CARGO_PROFILE_BENCH_DEBUG=1 RUSTFLAGS='-C force-frame-pointers=yes' \
uv run rust/tools/benchmarks/record.py --cpu 7 --repeats 5 --output baseline.jsonThe optimized profiling build completed in 40.99 s. Recorded end-of-run HEAD: b56092cc66a979b2f543da20846b965c3517ac36. The checkout was shared and HEAD moved during work; the recorder's source fingerprint stayed unchanged across all five timing passes: 5eea3716b30cf03831eacbc1f06711c2c622f915ebd8945a6940e6fab9d0d422. Source links use fetched master; the fingerprint identifies the measured benchmark/implementation input set. Baseline JSON SHA-256: 9517eb96c66a484cf305a13758a856d893f4608ee454c1a6ea16f693f62c4f26.
This was a shared host. The application build ran on CPUs 0–3 during part of the CPU-7 benchmark run, and other workloads were present. Wide ranges and nanosecond-scale differences require confirmation on quiet release hardware. A descriptive threshold crossing is not proof of statistical significance. The C oracle uses Cargo's optimized C build, rather than full OBS C IPO; profiling frame pointers also affect tiny call costs. No cross-platform or whole-application speedup/slowdown is inferred from shim benchmarks. dstr/printf_control remains C in both configurations and is excluded from Rust regression decisions.
Local evidence: /home/niteris/dev/obs-rust/reports/obs-profile-20261017/ contains baseline.json (per-run medians/confidence intervals), build logs, perf data/reports, assembly, runtime logs/maps/results, and the profiling harness. Raw Criterion samples are in target/criterion, baselines ports-20261017T172745Z-1 through ports-20261017T172745Z-5. Key evidence is reproduced here so triage does not depend on local file access.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsReady
Activity
vpacher commentedon Oct 18, 2026
Claiming: #1305 (hardware recording evidence)
Setup for the evidence runs:
libobs-with-rusttwin, selected byLD_LIBRARY_PATH. Each run records the mapped libobs from/proc/<pid>/maps.Plan:
PRs:
ci/recording_evidence_check.py+ tests: the renderer, mapped-libobs and encoder check (RED test first). I expect to open it today.vpacher commentedon Oct 18, 2026
First hardware recording evidence for the 5% gate (Linux x64), measured with the tools from #1405 and #1410.
Setup
33.0.0-beta6-1609-g9f573a9b3), one install. Clibobs.so.30(SHA-25690cc938e1114…) or thelibobs-with-rusttwin (4ce6136edc3d…), selected byLD_LIBRARY_PATH.libobs-opengland the other modules are the same files in both.OpenGL NVIDIA Corporation NVIDIA GeForce RTX 3060/PCIe/SSE2, checked in every run byci/recording_evidence_check.pytogether with the mapped libobs.Result (
recording.py report, median and range of 5 runs per backend)Gate: frame time PASS (0.962 <= 1.05), dropped frames PASS (none in any run).
Host-side, outside OBS (sampled every 10 s, first 80 s of each run excluded): CPU package power median C 93.2 W / Rust 93.1 W; container CPU median C 0.820 / Rust 0.831 cores (+1.3%; the OBS CPU ratio is +0.7%, same direction). Package power follows the time of day in both backends, not the backend.
Limits
recording.py runper backend, thenreport. I do not plan to run it now.The raw run files (per-second samples, encoder log lines, identities) are available if someone wants them attached.
ci: Check the renderer and the mapped libobs of a recording evidence …
benchmarks: Record full-app recording runs and report the 5% gate (Refs
swilk19 commentedon Oct 18, 2026
A measurement note from verifying #1299. It applies to every tiny-function case in #1295.
The profiling recipe in the #1295 report (
CARGO_PROFILE_BENCH_DEBUG=1 RUSTFLAGS='-C force-frame-pointers=yes' uv run rust/tools/benchmarks/record.py ...) adds frame pointers to the Rust code only.obs-c-oracle's C is compiled bycc, which does not readRUSTFLAGS, so in that build Rust functions getpush %rbp; mov %rsp,%rbp; ... pop %rbpand their C counterparts do not.vec2_abscompiles to the same three instructions in Rust and C. With the same binary, on Ice Lake:vec2/absRust/CCascade Lake: 1.04× vs 1.25×. Details are on #1299.
Suggested follow-up, either as part of this issue or separately: decide regressions from the plain bench profile only. If frame pointers are wanted for
perfattribution, pass the matching C flag as well (CFLAGS=-fno-omit-frame-pointer, whichcchonours) so both sides carry the same prologue. The recorder could enforce this by refusingforce-frame-pointersinRUSTFLAGSunlessCFLAGShas-fno-omit-frame-pointer.vpacher commentedon Oct 20, 2026
Thanks, this matches what we saw on #1301: there a layout change moved the C oracle by 3-5 ns, so those numbers used the same alignment flags for both languages (
RUSTFLAGSalign flags plusCFLAGS=-falign-functions=64 -falign-loops=32). The #1305 recording evidence above is not affected: release builds, no profiler, no extra flags.I can take the recorder guard as a separate small PR:
record.pystops whenRUSTFLAGShasforce-frame-pointers(or the function-alignment flags) andCFLAGShas no matching flag, and the report shows both. OK?zackees commentedon Oct 25, 2026
/ready
Triage: the tooling is merged (#1405 checks the renderer and the mapped libobs, #1410 records full-app recording runs and reports against the 5% bound). Left: real hardware runs (a GPU renderer, not llvmpipe under Xvfb, on an idle host) of C versus Rust with the alignment flags noted above, then confirm or dismiss the noisy regressions. Acceptance: the report from #1410's harness on at least one hardware host, posted here, with each regression either reproduced (and filed) or dismissed. P3, size:M.
vpacher commentedon Oct 31, 2026
Claiming: #1305 (the two items left after the 10-18 hardware report and the 10-25 triage)
Since 10-18, all nine children of #1295 closed (#1296–#1304), the libobs layout changed (hybrid
libobsplus the explicitlibobs-c-reference, not thelibobs-with-rusttwin), and the oracle C is now built at the shipped level (#3130). The 10-18 numbers no longer describe master.Plan (one comment with the results, no code change expected):
rust/tools/benchmarks/record.pyat current master on the Ryzen 9 5950X host with no build or other benchmark running (pinned to one CPU, 5 repeats; the host load is recorded with the results). No profiling flags, so Rust and C have the same frame-pointer and alignment settings (the note from swilk19 above). Then give a verdict for each of the 22 rows of the meta: resolve OBS Rust profiling regressions and validate recording performance #1295 inventory: dismissed (inside the 1.10 bound now), or reproduced (filed as a new issue with the numbers).-DOBS_BUILD_C_REFERENCE=ON: hybridlibobsagainstlibobs-c-reference, selected by the library path. At least 5 interleaved runs per backend throughrecording.py run, thenrecording.py report.Expected: results here within about 2 days. If a regression reproduces, I file it as its own issue and leave this one open on it.
vpacher commentedon Oct 31, 2026
Results for the two items of the 10-31 claim.
1. The #1295 inventory: 21 of 22 rows dismissed,
av1/metadatareproduced (#3175)rust/tools/benchmarks/record.py --cpu 31 --repeats 5 --max-ratio 1.10, master 538e920, Ryzen 9 5950X (Linux x86_64 LXC on the same host as part 2, no build or other benchmark running, load average about 2), Rust 1.98.1, GCC 14.2.0. No profiling flags:RUSTFLAGSandCFLAGSempty, so Rust and C have the same frame-pointer and alignment settings (swilk19's note above). The oracle C is at the shipped level (-O2 -ffp-contract=off -fno-strict-aliasing, #3127). Medians of the 5 pass medians; the last column is the range of the 5 paired Rust/C ratios. The 10-17 column is from the #1295 report (Ryzen 7 3700X): compare the ratios, not the nanoseconds.av1/extract/16384av1/extract/256av1/keyframe/16384av1/keyframe/256av1/metadataav1/metadata_itu_t35avc/extract/256avc/keyframe/16384avc/keyframe/256bmem/alloc_free/64bmem/countdstr/cat/128dstr/cat/4096dstr/safe_printf/128dstr/safe_printf/4096hevc/extract/256hevc/keyframe/16384hevc/keyframe/256vec2/absvec2/ceilvec2/floorvec3/rand/1av1/metadatais over the bound in every pass. A second run of--category av1alone gives 1.209 (av1/metadata_itu_t351.199), about 6 ns per call. Filed as perf: codec: av1/metadata and av1/metadata_itu_t35 are 1.12–1.21x the C, above the 1.10x bound #3175.bmem/countandvec2/absare 1-ns cases with wide paired ranges (0.63–1.59, 0.76–1.49); their medians are at 1.00.Outside the #1295 inventory: all pairs above 1.10 in this run
The full suite now has 321 pairs; most were added by ports after #1295. I did not check these one by one and did not file them: the list is for whoever decides how the 1.10 bound applies to them (#3138 set the pattern: a fix, or an exemption with its measured cost). The
format/*rows are the SIMD gap of #3004/#3008.101 of 321 pairs above 1.10 (0 exempt).
source_transition_clock/ratio_tiesscene_item_order/reorder2/16format/uyvx_to_i444/1080pformat/uyvx_to_nv12/1080pconversions/utf8_to_wcs/64service/get_nameconversions/utf8_to_wcs/4096signal/emit_global/4source_deinterlace_draw/render_framevideo_copy_plan/rgbx_and_reuse/1024signal/emit/4output_start/start_and_begin/1024audio_discard/pending_tick_stereoformat/yuy2_to_uyvx/1080pformat/yuy2_to_uyvx_c_scalar/1080pformat/uyvy_to_uyvx/1080pformat/uyvy_to_uyvx_c_scalar/1080pformat/uyvx_to_i420/1080psource_async_upload/texrenderconversions/wcs_to_utf8/4096canvas_rules/settersvideo_copy_plan/gpu_copy_plan/1024module_names/listed/missmodule_names/listed/lastencoder_roi/scale/16module_locale/is_default/samesource_media_admission/admissionmodule_names/file_nameconversions/wcs_to_utf8/64source_conversion_plan/planservice/get_idsource_async_upload/framemodule_names/manifest_pathconversions/utf8_to_wcs_ptr/64module_source_rules/checksource_draw_plan/async_framedstr/to_upper/4096dstr/to_upper/128module_locale/is_default/othernix_x11_hotkeys/route_and_decode/1024scene_item_names/load/16source_filter_chain/restoregraphics_sprite/subregion_spriteservice/can_try_to_connectnix_system_info/dmesgmodule_source_rules/versioned_id/unversionedformat/nv12_to_uyvx_c_scalar/1080pformat/nv12_to_uyvx/1080pconversions/utf8_to_mbs_ptr/asciiencoder_gpu_rescale/start_and_release/1024gif/scan_decode_5x1080pcanvas_draw/display_beginsignal/emit/0gif_frame/decode_1080p_simplescene_render_plan/texcoords_centered/16canvas_rules/createvideo_frame_timing/frame/1024lzw/decode_map_1080pwin_crash_report/modulesencoder_group_reconfig/frame/1024source_filter_chain/moveseffect_params/set_float_newmodule_names/config_pathsource_deinterlace_select/select_tickmodule_type_rules/protocol_listedsource_async_pacing/unbuffered_tickwin_crash_report/frameslzw/decode_stack_1080pnix_system_info/cpuinfoportal_shortcut_status/sync/64effect_params/set_float_samesource_deinterlace_select/long_queuescene_crop/scale_crop/16module_register_copy/whole_sizesource_draw_plan/source_rendercanvas_draw/canvas_textureeffect_params/set_matrix4_newnix_wayland_keys/keymap_and_keys/248source_async_pacing/buffered_ticksource_duplicate/scenecore_setup_rules/mix_stepgif_frame/decode_1080p_interlacedsource_async_pacing/walk_30vec2/closeoutput_pause/pause_unpause/256output_reconnect/disconnect/256source_deinterlace_pacing/unbuffered_tickmodule_load_rules/routesmodule_type_rules/output_checkaudio_mix/time_to_framesencoder_packet_ts/packet/1024calldata/heap/set_get_4state_stacks/scene_1000_itemsservice/load_stateav1/metadatacore_setup_rules/latest_neweraudio_discard/discard_tick_stereowindows_keys/init_and_names/64effect_params/set_vec4_sameencoder_roi/admit/16view/set_source swap2. The 5% recording gate at current master: PASS
Setup
OBS_LIBOBS_BACKEND=HYBRID,-DOBS_BUILD_C_REFERENCE=ON), one install. Rust: the hybridlibobs.so.30(SHA-256e581c4db81ca…). C:libobs-c-referencefrom the same tree, copied aslibobs.so.30into a separate directory first inLD_LIBRARY_PATH(111d76b1b864…, no Rust code in it).libobs-opengland all modules are the same files in both runs. The build needed-DCMAKE_CXX_FLAGS=-Wno-error=float-conversionwith Debian's Qt 6.8 (build(frontend): the app does not compile with Qt 6.8 since properties-view passes -Wfloat-conversion to its consumers (#3067) #3164); that changes no generated code.OpenGL NVIDIA Corporation NVIDIA GeForce RTX 3060/PCIe/SSE2, checked in every run byci/recording_evidence_check.pywith the mapped libobs. One 4K NDI camera source (DistroAV) + ALSA audio, base 3840x2160, output 1920x1080, 25 fps, an NDI output active during all runs. Recording: Simple mode, quality "Indistinguishable" (NVENC H.264), MKV.Result (
recording.py report, median and range of 5 runs per backend)Gate: frame time PASS (0.987 <= 1.05), dropped frames PASS (none in any run).
Outside OBS (sampled every 10 s, first 80 s of each run left out): container CPU median C 0.65 / Rust 0.66 cores; CPU package power median C 94.0 W / Rust 96.3 W, with overlapping run ranges (91.0–94.7 / 92.4–97.3 W). On 10-18 the package power followed the time of day in both backends, so I do not read the 2.3 W as a backend difference.
Compared with 10-18 (9f573a9, the twin layout), both backends are faster on the same scene: frame render time 3.48 / 3.35 ms then, 2.21 / 2.18 ms now; container CPU 0.82 / 0.83 cores then, 0.65 / 0.66 now. The earlier +0.7 % OBS CPU difference is not there in this series (1.000).
Limits: the same as on 10-18. One platform (Linux x64, NVIDIA), and a light workload for the frame budget (about 2.2 ms of 40 ms), so no run came near a skipped frame.
Raw data (the
record.pyJSON with every pass and confidence interval, the run JSONs ofrecording.pywith the per-second samples and encoder log lines) is available if someone wants it attached.