Performance wall: how many elements a canvas can draw

Each row keeps adding elements, all moving every frame, until the frame rate drops. The same scene is run as plain DOM with CSS transforms, as a 2D canvas drawing every element with drawElementImage, and as a worker drawing transferred ElementImage snapshots. The numbers are measured on your device when you press Run.

Not run yet.

Show the code the three scenes being timed
  1. The canvas rows: every card is a child of one drawable canvas. html is the markup of n cards.
  2. 2D row: draw every element on each paint. A frame loop changes some text and calls canvas.requestPaint().
  3. Worker row: the canvas goes to a worker, and only elements that changed get a new snapshot.
  4. The worker. It keeps the newest snapshot of each element and draws them all every frame, whatever the main thread is doing.

Cells are frames per second with that many elements (for worker rows: the worker's frame rate, which is what moves on screen). The wall is the largest count that held 90% of this display's refresh rate. A row stops at the first count under half the refresh rate.

Latency: from a DOM change to the frame that shows it

The wall above measures frame rate. This measures delay. Each sample adds a line of text and reads when the browser presented it, from the element's Element Timing entry. The fixtures are drawn in the box at the top of the page.

RouteMedianDetail
Not run yet.

Where a long frame goes

From long-animation-frame entries, which exist only for frames over 50 ms. The scene is a grid of small cells whose text all changes every frame. The cell count doubles until plain DOM frames are that long, and the canvas then draws the same grid.

SceneFrameScriptStyle, layout, paintAfter the main threadDetail
Not run yet.
Show the code latency, long frames and the device tier
  1. The change being timed. A new element with an elementtiming attribute.
  2. 2D canvas: compare the time of the paint event with the presentation time.
  3. A canvas that draws nothing still gets an entry.
  4. Worker: snapshot in the paint event, draw in the worker, report on the epoch clock.
  5. The latency worker.
  6. Long frames: split each entry at renderStart, styleAndLayoutStart and presentationTime.
  7. The device tier: navigator.cpuPerformance, or cores and memory.
  8. Software WebGPU adapter check.

Device tier

Asks for an adapter and no device.

Reading the result

Findings

What the rows mean