Next · Unreleased
Working-tree content. Subject to change and not yet released. Commit: e3d4530507.
TileFalling — data-driven performance flow
How the engine's game state and the falling-tile lane exchange data, and why it is cheap: JS only publishes what happened; the UI runtime reads plain numbers and derives everything else.
Sources: packages/rhythm-engine/src/driver/game-state.ts, src/components/TileFalling.tsx,
src/components/tile-pool.worklet.ts, src/components/tile-note-status.ts, src/components/tile-chart-soa.ts.
1. Threads and data ownership
2. One frame on the UI runtime
3. Status ring — the only JS to UI channel per note
4. Slot lifecycle
5. Performance cost map (what is data, what is work)
Data-driven rules
stampsays which frame wrote the block,isRunningsays whether to advance: no freshness guess.- Tiles integrate
velocity x dtand only re-anchor whenepochchanges (seek, rewind, tempo jump). - A stalled JS thread cannot delay a tile: the pool lives on the UI runtime and never reports back.
- Per-chart cost (
buildTileChartSoA, layout) is paid once inuseEffect, not per frame.
6. Metrics worth sampling
7. Cost per runtime — JS / Worklet (UI) / Worker / Native render
Qualitative budget from code reading, not measured. Fill the "measure" column from the sim
(react-devtools-sim-profiling, FX frame timer) before quoting numbers.
Where the work moved in the new logic
- Per note, JS now only writes one status entry. Slot binding, position and fade moved to the UI runtime.
- A stalled JS thread cannot delay a tile, because the pool is on the UI runtime and reads shared cells.
- The only heavy off-thread job is atlas packing, and it runs once per sheet, not per frame.
- Per-frame cost is therefore dominated by one place: the UI runtime (
reconcileTilesplus sprite writes).