Performance and efficiency optimizations across the telemetry server, asset delivery, and dashboard polling.
Performance & Optimizations
- Process Spawning Reduction (
appStorage): Wrapped partition storage checks (/bin/df -k /mnt/lg/appstore) in a 60-second TTL cache, eliminating ~30 child process spawns per minute during active dashboard monitoring and preventing libuv fork contention on Node 0.12. (#56) - Client-Side Polling Throttling (Page Visibility API): Dashboard polling in
ui.htmlnow pauses completely when the browser tab is backgrounded, minimized, or the phone screen is locked. Returning to the tab immediately fetches fresh stats and resumes the 2-second interval. (#56) - HTTP Gzip Compression: Pre-compresses
ui.htmlasynchronously at boot via corezlib(UI_HTML_GZ), reducing HTML transfer size from 75.0 KB to 23.1 KB (~69% reduction) with zero per-request CPU overhead. (#56) - In-Memory Static Asset Caching: Pre-caches font files (
Outfit.ttf,Manrope.ttf) and static assets in RAM (ASSET_CACHE) on first read, eliminating repetitive eMMC flash reads. (#56) - Hardware & Sysfs Read Caching: Flash wear lifetime (
emmcInfo), swap backing (swapBacking), and interface MAC addresses are cached permanently after startup/first read. Magic Remote info and AdBlock status are cached with 30s TTLs, avoiding continuous flash reads on every 2-second collection tick. (#56)