Repository navigation
Conversation
Firefox's WebGL spends a lot of main-thread time per draw call, and a frame of the office was about 1,890 of them, ~840 just redrawing the sun's shadow. - On Firefox the sun's shadow is redrawn every other frame (about 22% fewer draw calls on average), and a Retina screen is drawn at 1.5x instead of 2x (about 44% fewer pixels to fill and multisample-buffer memory to hold). - In every browser, the first-person crosshair ray stops at the longest reach instead of testing the whole building's meshes every frame.
muguetdev
pushed a commit
to muguetdev/agent-office
that referenced
this pull request
Oct 27, 2026
…om Agent Office AgentSystemLabs#375) Firefox's WebGL spends a lot of main-thread time per draw call, and a frame of the office was about 1,890 of them, ~840 just redrawing the sun's shadow. - On Firefox the sun's shadow is redrawn every other frame (about 22% fewer draw calls on average), and a Retina screen is drawn at 1.5x instead of 2x (about 44% fewer pixels to fill and multisample-buffer memory to hold). - In every browser, the first-person crosshair ray stops at the longest reach instead of testing the whole building's meshes every frame.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
aimtick) stops at the longest interaction reach + 1 m instead of testing the whole building's meshes. First-person targeting only uses hits within reach, so behavior is unchanged; third-person clicks keep the unlimited ray, so "Walk closer to that first" still shows.Why Firefox
Profiled in Firefox 159 on a MacBook Air M4 (16 GB): the tab's main thread was 94–99% busy in the frame callback. That cost is per-call JS/IPC overhead (Firefox remotes WebGL commands to another process), not GPU fill: OutlineEffect's two passes plus the shadow pass, plus the crosshair raycast.
Profile samples (same ~5 s window, before → after):
OutlineEffect.render): 4,584 → 3,556WebGLShadowMap.render): 642 → 269Validation
npm run typechecknpm run buildnpm test. 569 tests ran together;tests/workers.test.ts(32 tests) passed when run on its own. It stalled during the full run on a heavily loaded machine (load average 12–24), and it is server-side, untouched by this change.Not verified