Interactive browser charting terminals often ship with two invisible performance bugs: heavy Cumulative Layout Shift (CLS) as hydration swaps skeleton toolbars, and continuous GPU/main-thread wakeups caused by preserveDrawingBuffer: true or ungated requestAnimationFrame loops.
While profiling our live free 1-second WebGPU/WebGL2 Market Terminal, stabilizing container dimensions before hydration dropped measured layout shift from CLS 0.6271 to CLS 0.0016 in headless Chromium—without changing chart responsiveness.
1. Killing Hydration Layout Shift (0.6271 -> 0.0016 CLS)
Financial terminals combine top symbol bars, multi-pane split containers, bottom backtest docks, and floating crosshair legends. When initial HTML reserves 0px for React-mounted toolbars or dynamic panels, browsers trigger sequential shifts as widgets mount.
Fix:
- Lock explicit
min-heightandaspect-ratio/ flex-basis slots in static SSR shell CSS before hydration. - Keep secondary educational drawers collapsed below the chart canvas rather than pushing the viewport down on mount.
2. Dirty-Bit requestAnimationFrame + On-Demand PNG Readback
Keeping { preserveDrawingBuffer: true } forces Safari/Metal and composited browser tiles to preserve backbuffer pixels across every swap pass. Switching to preserveDrawingBuffer: false, drawing synchronously on explicit snapshot export, and queuing requestAnimationFrame only when document.hidden === false, the canvas is in viewport, and price ticks or pointer gestures mark dirty = true eliminates unnecessary GPU copies:
export function scheduleChartFrame(state: { rafId: number; dirty: boolean; inView: boolean; draw: () => void; }) { if (state.rafId || document.hidden || !state.inView || !state.dirty) return; state.rafId = requestAnimationFrame(() => { state.rafId = 0; state.dirty = false; state.draw(); }); } Live Terminal, Benchmark Dataset & Native Mac Studio
- Open the Free 1-Second Browser Terminal (
$0, Zero Login): https://nandai.org/trade - Live BTC-USD Depth & 1s Chart: https://nandai.org/trade/btc-usd
- Destiny Trader Overview (
1s–30sDesktop & Sovereign Feeds): https://nandai.org/trading - Reproducible Endpoint & M4 Pro Telemetry Dataset (
CC-BY-4.0):https://doi.org/10.5281/zenodo.24711718 - Download Destiny for Apple Silicon Mac (
M1–M4): https://nandai.org/download
