Frontory

Open code, practice, and notes →

Download source with English comments · for reading

OffscreenCanvas · 24 Request and Display Latency

Series contents · Technology map

Stage: Responsiveness Comparison Project · Editable example · Storage ID: offscreen-canvas-step-24

Goals and learning outcomes

Prerequisites

Prepare the experiment results for Loss and Recovery data from Unit 23, “Canvas Context Loss”.

Key concepts and explanations

Visible updates

Message arrival and an update appearing on screen do not happen at the same time. A processing ack alone does not establish total display latency.

Separating measurements

Record main-thread round-trip time separately from Worker processing duration. Describe how actual display updates are observed and the method's limits.

Practice setup

First check the execution scope guidance on the example screen. The following describes the environment needed to extend the assignment in a separate project. The existing offscreen-canvas-01·02·03 are starting examples for supported browsers. Implement the new units in main-thread and Worker files in a separate local HTTP project. Check API and context support, and provide a main-thread fallback on a new Canvas if transfer fails. Preserve CSP and isolation, and record performance measurements yourself.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. In src/day-24.js in a separate practice project, include input IDs in rendered-frame results and log observations of visible updates. Refer to the existing Unit 1·14·28 examples only as starting points.
  2. Input conditions: 20 color-change requests. Baseline: Every event. Run under the baseline conditions, then record observations and errors in notes/day-24.md.
  3. Variable: Transmission frequency; changed value: Per frame. Run again through the same input path. Deliverable to save: Round-trip, processing, and observed latency records. Hypothesis to check: The tradeoff between input latency and message count becomes visible. Compare it with the actual results, and record whether they agree and why they differ.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
Transmission frequencyEvery eventPer frameThe tradeoff between input latency and message count becomes visible.

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. Which processing stage does Visible updates affect in this exercise? Input cases: 20 color-change requests.
  2. Variable: Transmission frequency. Hypothesis to check: The tradeoff between input latency and message count becomes visible. Did the actual results agree with the hypothesis? Explain the evidence in terms of Separating measurements.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

The measurement runs from main-thread request submission to handling the painted acknowledgment. It does not separately measure compositing, visible-display latency, or Worker processing time.

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Canvas Context Loss · Next: Resolution and Workload

Open code, practice, and notes →