Performance: load, parallelism and native core
Status: in progress.
Goal
The fastest software possible, technical cost accepted: work spread over the cores, the database off the event loop, a native core where it pays, and folders by theme, function and sub-function in every language. More memory or computation is accepted when it makes the interface smoother, measured per profile, TV included.
Steps
| Step | Content | State |
|---|---|---|
| A1 | Database off the event loop, atomic settings writes (391, 392); TV under writes: WebSocket p50 120 to 15 ms | done |
| A1b | Settings in one request per batch, asynchronous get_db (394, 395); TV: PUT p50 220 to 78 ms | done |
| A2 | ffmpeg stopped after 120 s without progress, bounded stderr, one launcher, storyboards at background priority (396 to 398) | done |
| A3 | MediaExecutor (402): one heavy lane, 1 + clamp(nproc/2, 1, 4) threads; desktop: an import behind 20 storyboards 31 to 36 s down to 1 s | done |
| A4 | Folded search and sort keys stored per item (420); 3 820 items: search 37 to 48 ms down to 9 to 11 ms | done |
| A5 | One rule, one source: bobine without app.config 0.23 to 0.13 s (467), shared generated outputs (468), proposed media names served by POST /api/media/names (470, 471) | done |
| A6 | One broadcast socket per tab (485), serialized once per broadcast (513): 2 KB state_change at 10 clients 188 to 275 µs down to 55 to 80 µs | done |
| A7 | Native audio probe on by default (498); 140 µs per probe round trip | done |
| A8 | Cargo workspace native/ with a shared protocol crate | to do |
| A9 | Native MP4 video probe, probe_video (517): ffprobe takes 56 ms per video on a desktop and 400 ms on a TV, the native probe 1.7 ms for a 52-minute class; 28 files compared: 18 identical, 10 handed back to ffprobe, 0 mismatch | done, not measured on a TV |
| A10 | bobine-devices: screens, WASAPI, inputs on the four profiles (505 to 512) | waiting for hardware |
| S | Folders by theme, one theme per pull request before the step that touches it | to do |
Target tree
The same themes everywhere: backend/app/theme/function/, backend/tests/theme/, frontend/src/components and lib by theme and function, native/crate/src/theme/platform/, com.bobine.app.theme. Guards: no database access in async def, no subprocess outside the launchers, about 12 files per folder.
Pending decisions
Rust dependencies core-graphics and landlock; a multiplexed WebSocket contract (a published format); a full Rust backend only after RSS and CPU measurements on a TV.
Pitfalls
Read then add on a settings key is not atomic: always put_setting. A route a test calls directly keeps its async form. A Session made by the dependency serves in the threadpool only, never concurrently. Compare suite durations of main and a branch in alternating runs: the load of the machine varies by half.