From 34adb6fb327463102ce505f6c2eacdf609e4e6b9 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Sun, 28 Jun 2026 17:35:46 -0700 Subject: [PATCH] worker orbs: run at ~30fps when reduce-effects is on (perf) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pairs with the previous commit (orbs now run under reduce-effects). When the user has asked for performance (reduce-effects on) we don't need the orbs at 60fps — the slow drift and sparks are indistinguishable at 30, and dropping every other render roughly halves the per-frame canvas cost, keeping the "orbs under reduce-effects" experiment cheap. The canvas still ticks at 60fps and frameCount still increments every tick, so `time` stays real-time and the drift speed is unchanged — we just draw it half as often. Precedence: the existing fully-asleep ~20fps throttle still wins; the 30fps cap only applies awake + reduce-effects. Chrome users with full effects keep 60fps — no reason to dim them. --- webui/static/worker-orbs.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webui/static/worker-orbs.js b/webui/static/worker-orbs.js index 449969dc..90b973c4 100644 --- a/webui/static/worker-orbs.js +++ b/webui/static/worker-orbs.js @@ -605,10 +605,18 @@ if (performance.now() < _scrollPauseUntil) return; frameCount++; - // Fully asleep: render at ~20fps. The drift is at crawl speed so the - // difference is invisible, and the canvas GPU cost drops by two thirds - // for the hours the dashboard sits idle. Wakes re-run every frame. - if (sleepLevel > 0.95 && frameCount % 3 !== 0) return; + // Frame-skip throttles. The canvas ticks at 60fps; we drop renders to cut cost. + // frameCount still increments every tick, so `time` below stays real-time and the + // drift speed is unchanged — we just draw it less often. + if (sleepLevel > 0.95) { + // Fully asleep → ~20fps: drift is at crawl speed so it's invisible, and the + // GPU cost drops two-thirds for the hours the dashboard sits idle. + if (frameCount % 3 !== 0) return; + } else if (window._reduceEffectsActive) { + // Reduce-effects on (user asked for performance) → ~30fps: the slow drift and + // sparks look the same, the per-frame cost roughly halves. + if (frameCount % 2 !== 0) return; + } const time = frameCount / 60; const w = canvas.width; const h = canvas.height;