Conceptual
Login

Memory Copying Across the Wasm Boundary

Strings, arrays, and objects cannot be passed by reference into linear memory; they must be encoded and copied in (e.g. TextEncoder into a typed-array view of wasm memory) and copied back out, an O(n) tax on every exchange. Fast designs keep data resident in linear memory across calls and pass only integer handles and offsets.

This Concept is waiting for its first lesson!

Strings, arrays, and objects cannot be passed by reference into linear memory; they must be encoded and copied in (e.g. TextEncoder into a typed-array view of wasm memory) and copied back out, an O(n) tax on every exchange. Fast designs keep data resident in linear memory across calls and pass only integer handles and offsets.

Are you a teacher? Sign in to start contributing.

Sign In