Skip to content

perf: headless recording via on-demand render runner - #44

Merged
wlgys8 merged 2 commits into
mainfrom
perf/issue-37-headless-recording
Sep 14, 2026
Merged

wlgys8 merged 2 commits into
mainfrom
perf/issue-37-headless-recording

Conversation

@wlgys8

@wlgys8 wlgys8 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switch the motrixsim headless renderer to the render service's on-demand runner: frames are rendered only when a sync arrives and GPU readbacks are drained in-frame, so nothing renders while idle and recording runs at full render speed (fixes perf: multi-env headless video recording is superlinearly slow (per-env render + blocking readback per frame) #37)
  • Remove the RenderConfig.render_fps cap option — headless recording is now always unlimited-rate; the render loop no longer paces captures to a fixed tick
  • Add scripts/bench_headless_capture.py, a standalone probe that times render submission, blocking readback, take, and encode separately (serial vs pipelined schedule)
  • Bump motrixsim to 0.10.1.dev123478

Verification

  • scripts/bench_headless_capture.py: capture+encode at 1280x720 ~100 fps, 256x256 ~200 fps, 1080p ~80 fps (batch 16, unlimited rate)
  • End-to-end play.py record_video=true on cartpole and microduck-walk-flat: 10 s clip records in ~12 s wall including startup
  • motrix_env_core/tests + motrix_env_motrixsim/tests: 173 passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The PR introduces at least one correctness issue (interactive renderer also gets fps=None unintentionally) and the new benchmark mis-attributes pipelined timing phases, making its results misleading.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR improves headless video recording performance for MotrixSim-backed environments by switching headless rendering to an on-demand runner (render only on sync) and updating dependencies/tools to measure and validate the new capture behavior.

Changes:

  • Switch headless MotrixSimRenderer to construct RenderApp using the on-demand runner (fps=None) to avoid idle rendering and improve capture throughput.
  • Add a standalone benchmark script to attribute headless capture time across submission, readback wait, pixel extraction, and encoding (serial vs pipelined schedule).
  • Bump motrixsim to 0.10.1.dev123478 in both pyproject.toml and uv.lock, and update renderer tests for the new RenderApp constructor signature/behavior.
File summaries
File Description
uv.lock Updates the locked motrixsim/motrixsim-core versions to the new dev build.
scripts/bench_headless_capture.py Adds a benchmark probe to measure headless capture/encode costs and compare serial vs pipelined capture schedules.
motrix_env_motrixsim/tests/test_renderer.py Adjusts mocks/assertions to account for the RenderApp(..., fps=None) headless constructor and updated sync/capture expectations.
motrix_env_motrixsim/src/motrix_env_motrixsim/renderer.py Switches headless renderer creation to the on-demand runner and documents the capture/readback synchronization shape.
motrix_env_motrixsim/pyproject.toml Pins motrixsim to 0.10.1.dev123478.
Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread motrix_env_motrixsim/src/motrix_env_motrixsim/renderer.py Outdated
Comment thread scripts/bench_headless_capture.py
…ench timing

- renderer: pass fps=None only for headless RenderApp; windowed mode keeps
  the library default (fps is a headless-only knob), resolving review thread
- bench_headless_capture: attribute pipelined _grab() to the take phase and
  account the final pending-frame flush in wait/take/encode totals
@wlgys8
wlgys8 merged commit 7b4dcb1 into main Sep 14, 2026
5 checks passed
@wlgys8
wlgys8 deleted the perf/issue-37-headless-recording branch September 14, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: multi-env headless video recording is superlinearly slow (per-env render + blocking readback per frame)

2 participants