qol: skip rendering offscreen chat messages - #8153
Open
dclstn wants to merge 3 commits into
Open
Conversation
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.
Adds a
containedclass alongside the effect class inapplyUsernameEffect, applyingcontent-visibility: autoto messages with a username effect so they skip paint entirely while outside the viewport.contain-intrinsic-size: auto 28pxkeeps a placeholder height for never-rendered lines so scrollback geometry stays correct (theautokeyword makes the browser reuse each line's real height once it has rendered). Messages without effects are untouched.Every effect is an infinite
background-positionanimation onbackground-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):
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
containedclass 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