Documentation menu

Performance Measurement

Attribute time to client evaluation, retained publication, GPU work, and presentation before choosing an optimization.

An update can spend time in client evaluation, scene publication, GPU execution, and display presentation. Measuring these phases separately makes it possible to choose an optimization for the actual bottleneck. A smaller scene diff, for example, does not necessarily reduce GPU cost, and faster body evaluation does not by itself establish lower display latency.

Client Performance Phases

On the client, follow the update through model mutation, derived propagation, view evaluation, layout synchronization, and reconciliation. Memoization can avoid eligible body construction, while changed-value writes can reduce dependency invalidation earlier in that sequence. Neither saving necessarily changes what the server must draw.

Use representative application trees and real text. Tiny primitive-only microbenchmarks can miss shaping, mounted state, environment, and interaction overhead that dominates an actual screen.

Server Performance Phases

Server frame metrics distinguish scene preparation, renderer work, and the interval through submission acknowledgment queue admission. CPU frame duration does not include a guarantee that clients received those messages or the display activated the frame.

The scheduler can use estimated asynchronous GPU tail time to adjust lead. Read presentation timestamps and frame identities to measure actual activation rather than treating queue submission time as visible completion.

Damage and Effect Costs

The relationship between a model change and GPU work depends on composition. Updating a small element can invalidate a much larger blur or backdrop region, and each reused target image has its own damage history. Retained-run caching can save work in these cases only while admission and fallback preserve every required input.

The profile overlay can help inspect output behavior without making the overlay itself request frames. Damage outlines require the corresponding diagnostic build support.

Steady-State and Transition Benchmarks

Use separate measurements for initial mount, unchanged evaluation, small state updates, resize and reflow, scrolling, and animation. To make comparisons meaningful, keep font assets, viewport size, backend, presentation mode, buffering, and build profile consistent across runs.

Follow retained memory and queue growth alongside frame time. A change that saves work for one frame can still increase cost over a longer run if it retains snapshots or callbacks without a bound. Steady-state measurements help reveal that tradeoff.

Optimization Constraints

Do not advance accepted damage history after failed submission, reuse active scanout storage on GPU completion alone, or publish candidate callbacks before retained acceptance. Those shortcuts can improve a local timing number by violating the lifecycle being measured.

See the checkout's detailed Kit performance guide for benchmark fixtures and frame lifecycle for milestone definitions.

Source Reference

The following files in the Hera checkout define the behavior described on this page.

  • crates/kit/docs/PERFORMANCE.md
  • crates/server/src/frame/mod.rs
  • crates/server/src/frame/trace.rs
  • crates/renderer/src/profiling/README.md