optimize CPU/RAM
Loving Kiyotaka! Noticed long sessions can slow my Mac. A few practical tweaks (similar to what TradingView does) could help a lot:
Throttle & batch WebSocket updates (e.g., 10–20 Hz) and don’t render in the WS callback—render only via requestAnimationFrame.,
Keep data in bounded ring buffers (e.g., 10–20k points per series); avoid unbounded arrays.,
Downsample to viewport (≈ one point per pixel column) before drawing.,
Move parsing/indicators to a Web Worker; consider OffscreenCanvas for rendering.,
When the tab is hidden, pause rendering and lower ingest rate.,
These usually cut CPU/RAM use dramatically while keeping charts snappy.
Status: Completed
No comments yet
Be the first to share your thoughts.