Zvessa docs

Performance for builders

Zvessa must feel instant and never drain the battery or heat the phone, on a five-year-old Android as much as a new iPhone. These are the budgets every block, kit, engine and mini-app keeps. The app-wide rules and how the core meets them: docs/PERFORMANCE.md.

The hooks #

src/lib/activity.ts tells a block when it may do work:

HookTrue when
useLive()The screen is showing and the app is in the foreground
useDecorativeMotion()useLive() and the phone's Reduce Motion is off
useReduceMotion()The phone's Reduce Motion is on
useAppActive()The app is in the foreground

Timers, sensors, media and game loops start only while useLive() is true and stop when it turns false. Decorative animation (beams, shimmer) runs only while useDecorativeMotion() is true.

Budgets #

Targets every change is measured against:

WhatBudget
Frames60 fps while scrolling and animating; no work over 16 ms on the JS thread
StartThe dashboard shows from cache before the network answers
IdleZero timers, animations, sensors or network when nothing on screen changes
A pageDraws only what's on screen; long lists are virtualised
A queryReads through an index with a limit; returns only what the screen shows
ImagesSized to their box before upload; cached; no full-size photos in lists
A mini-appWell under 200 KB of HTML; sleeps when hidden
App sizeOnly what's used ships: packages are added when their block starts

Rules #

Nothing runs that can't be seen.

Do the least work.

Ask the server for less.

Network and battery.

Checking #