Frontory

Open code, practice, and notes →

Download source with English comments · for reading

WebAssembly · 28 Evaluating Actual Bottlenecks

Series contents · Technology map

Stage: Correctness and Bottleneck Evaluation · Editable example · Storage ID: webassembly-03

Goals and learning outcomes

Prerequisites

Prepare the experiment results for Reproducibility and Adoption criteria from Unit 27, “Environment and Adoption Criteria”.

Key concepts and explanations

End-to-end latency

Excluding compilation and transfer may misrepresent the actual user experience. Read cold and warm results separately.

Evidence-based decisions

Wasm does not automatically accelerate every task. Decide whether to adopt it based on correctness and actual bottlenecks.

Practice setup

The iframe preview is an experiment with WebAssembly.Memory and JS reference computations; do not present it as execution of an actual Wasm module. Practice with actual modules in a separate Node 22+ environment or a controlled local web project. Use kernel.wat·kernel.wasm·benchmark.mjs in the existing src/labs/webassembly-02·03 folders, and rebuild with the official wat2wasm tool when modifying WAT. Preserve CSP·isolation, and record 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 day-28.mjs in a separate practice project, run node src/labs/webassembly-03/benchmark.mjs and complete a report on array transformations in JS·actual Wasm. Refer to the existing Unit 1·14·28 examples only as starting points.
  2. Input conditions: multiple sizes and repeat counts. Baseline: function only. Run under the baseline conditions, then record observations and errors in notes/day-28.md.
  3. Variable: comparison scope; changed value: entire request. Run again through the same input path. Deliverable to save: a report on cold·warm·copies·correctness·adoption rationale. Hypothesis to check: Considering the total cost may change the decision. Compare it with the actual results, and record whether they agree and why they differ.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
comparison scopefunction onlyentire requestConsidering the total cost may change the decision.

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 End-to-end latency affect in this exercise? Input cases: multiple sizes and repeat counts.
  2. Variable: comparison scope. Hypothesis to check: Considering the total cost may change the decision. Did the actual results agree with the hypothesis? Explain the evidence in terms of Evidence-based decisions.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

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

Next learning

Previous: Environment and Adoption Criteria

Open code, practice, and notes →