Skip to content

qol: skip rendering offscreen chat messages - #8153

Open
dclstn wants to merge 3 commits into
masterfrom
qol/chat-content-visibility
Open

qol: skip rendering offscreen chat messages#8153
dclstn wants to merge 3 commits into
masterfrom
qol/chat-content-visibility

Conversation

@dclstn

@dclstn dclstn commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Adds a contained class alongside the effect class in applyUsernameEffect, applying content-visibility: auto to messages with a username effect so they skip paint entirely while outside the viewport. contain-intrinsic-size: auto 28px keeps a placeholder height for never-rendered lines so scrollback geometry stays correct (the auto keyword makes the browser reuse each line's real height once it has rendered). Messages without effects are untouched.

Every effect is an infinite background-position animation on background-clip: text, plus an SVG stroke filter for the textured ones, so each one repaints continuously — including offscreen lines, meaning the cost scales with the entire message buffer rather than the ~20 visible lines. This came out of investigating a user report that effects lag streams as chat builds up.

Full 2×2 matrix measured on a live stream (busy chat, effects spoofed onto ~90% of usernames via a dev shim, identical 645-line buffer for all four runs, 15s rAF sampling per run):

fps p95 frame time
no rule, no effects 222 4.4 ms
no rule, ~450 effects 97 15.9 ms
rule, no effects 188* 6.9 ms
rule, ~450 effects 215 5.9 ms

Effects alone cost ~56% of frame rate at a saturated buffer; with the rule the same buffer runs within ~3% of a clean chat. Zero dropped video frames in all runs (video decode is unaffected either way — the lag is chat/page rendering).

* With no effects present the contained class is never applied, so this cell exercises identical styles to the top-left cell; the lower reading is wake-up noise from the tab having just been foregrounded (it recorded a 319ms worst frame in its first second), not overhead from the rule.

At realistic effect counts (~130 in a 150-line buffer) the cost is small (~8% fps), so this is headroom for growing Pro adoption rather than a fix for a current regression. Scrollback, scroll anchoring, and the paused-chat flow were checked live and behave normally; visible effects still animate.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant