Skip to content

[WASM] Reduce record-phase cost for WebGPU and Skia #26047

Closed

Description

@MartinZikmund

What would you like to be added? 💡

Make the per-frame record phase cheaper on WebAssembly, where it limits the frame rate under the Mono interpreter, especially with the WebGPU backend.

Profiling RealWorld_SpotlightMenu shows two hot spots:

  • WebGpuCommandRecorder.Concat takes ~44% of WebGPU recording. Every visual's offset goes through a full Matrix4x4 multiply, which runs as scalar code under the interpreter. The recorder's save stack is also regrown from empty on every recording.
  • Matrix3x2Extensions.Transform(Rect), used by visual culling for every visual on every frame on all backends, transforms four corners and takes their min/max even when the matrix is a plain translation.

Why is this needed? 🤔

On a Pixel Tablet (interpreter build), the record phase costs 81 ms per frame for WebGPU and 42 ms for Skia/WebGL on RealWorld_SpotlightMenu. That caps those backends at 15 and 22 fps.

For which platforms 📱💻🖥️

WebAssembly

Anything else we need to know? 💬

Both costs are mostly plain 2D translations, the most common visual transform, so a translation fast path removes most of them.

Activity

  1. self-assigned this
    on Nov 4, 2026
  2. added
    kind/enhancement
    platform/wasm 🌐
    triage/untriaged
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/enhancementplatform/wasm 🌐triage/untriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions