Skip to content

perf(desk): stop restyling the whole desk on every camera frame - #8

Merged
kanywst merged 1 commit into
mainfrom
perf/tbt
Oct 24, 2026
Merged

kanywst merged 1 commit into
mainfrom
perf/tbt

Conversation

@kanywst

@kanywst kanywst commented Oct 24, 2026

Copy link
Copy Markdown
Member

Final production Lighthouse after #7 showed desktop (devtools throttling) at 72: TBT 800–900 ms from 20 long tasks of ~80 ms, all inside the intro animation.

Cause. The camera wrote --z onto #world on every frame so the pile headings could scale with zoom. A custom property inherits, so each frame restyled the entire desk subtree.

Fix. The few headings now get scale directly, and only when it changes.

Local, devtools throttling, desktop:

Before After
Performance 72 100
TBT 880 ms 0
Long tasks 20 0
Main-thread work 3.2 s 0.16 s

Every zoom frame gets cheaper too, not just the intro. The overview looks the same (headings scale to 2.2 at 17% zoom). e2e: 43 passed.

The camera wrote --z onto #world each frame so the pile headings could scale
with zoom. A custom property inherits, so every frame restyled the entire desk:
20 long tasks of ~80 ms during the intro and 880 ms of total blocking time on
desktop. The few headings are now scaled directly, and only when the value
changes. Desktop Lighthouse (devtools throttling) goes from 72 to 100, TBT to 0.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2053bde1-8249-461e-8763-67fd0b9e6127
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

claude Bot commented Oct 24, 2026

Copy link
Copy Markdown

Clean against the five areas. The label scale moves from the inherited --z custom property to el.style.scale, which goes through the CSSOM, so it adds no CSP exposure and no new content path. unplace() clears the inline scale and resets labelScale, so list view and no-JS are unchanged, and setMode('desk') re-applies it. The let labelScale declaration comes after its first use in unplace(), but nothing calls unplace() before module init finishes, so there is no TDZ error.

@kanywst
kanywst merged commit 96d2cfb into main Oct 24, 2026
8 checks passed
@kanywst
kanywst deleted the perf/tbt branch October 24, 2026 14:35
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