Stop rendering album cards that are off screen, and split card blur from panel blur
Searching a single letter over a real library puts 340 cards in one grid, each with a cover image, a shadow and a backdrop blur, all of them live whether or not they are on screen. On musicdolphin that saturated the renderer badly enough that a DevTools Runtime.evaluate could not be scheduled on the main thread inside 30 seconds, which is a fair description of what "sluggish" felt like. content-visibility: auto on the grid's cards is the browser's own answer: off-screen cards skip layout, paint and compositing and come back as they scroll near the viewport. The grid's tracks are sized by minmax(180px, 1fr) rather than by card content, so skipping that content cannot move the columns; contain-intrinsic-size supplies the block-axis guess and `auto` remembers each card's real size after its first render, so scroll height and offsetTop - which BrowseView's keep-the-selection- on-screen effect reads - stay honest. Not behind ?pi=1: there is no visual difference to trade away. SHOW_CARD_BLUR separates the repeated frosted surfaces (every card, every list row) from the handful of panels wrapped around them, because the two behave nothing alike and lumping them together is what made the first Pi profile five times slower. A panel is one live backdrop copy that buys its whole subtree a compositing layer; a card is one of three hundred sitting directly over the animated canvas. ?pi=1 now drops the card blur and keeps the panel blur. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
import type { CSSProperties } from "react";
|
||||
|
||||
import { LOW_POWER } from "./lowPower";
|
||||
import type { Group } from "./search";
|
||||
import type { UiState } from "./keyboard";
|
||||
|
||||
@@ -52,6 +53,17 @@ export const SHOW_GLASS_BLUR = true;
|
||||
* half the frames) rather than making it go away. */
|
||||
export const SHOW_AMBIENCE = true;
|
||||
|
||||
/** Frost the *repeated* glass surfaces - every album card in the grid, every row in a
|
||||
* track list - as opposed to the handful of panels wrapped around them.
|
||||
*
|
||||
* Separate from `SHOW_GLASS_BLUR` because the two behave nothing alike, and lumping
|
||||
* them together is what made the first attempt at a Pi profile five times slower. A
|
||||
* panel is one live backdrop copy that buys its whole subtree a compositing layer. A
|
||||
* card is one live backdrop copy out of three hundred sitting directly over the
|
||||
* animated canvas, so every canvas frame re-blurs all of them. Measured on the Pi with
|
||||
* a full album grid on screen, Chromium: see lib/lowPower.ts. */
|
||||
export const SHOW_CARD_BLUR = !LOW_POWER;
|
||||
|
||||
/** Run the purely decorative CSS animation loops: the room page's bubble field and
|
||||
* the dolphin mascot's bob/swim. Left on even under `?pi=1`: switching them off on the
|
||||
* Pi moved the idle figure by 0.4 percentage points, which is noise, and they are the
|
||||
|
||||
Reference in New Issue
Block a user