← Back to release summary

WebAssembly String References

Category
WebAssembly
Type
New or changed feature
Status
In developer trial (Behind a flag) (Chrome In developer trial (Behind a flag))
Intent stage
Dev trials

Summary

Allows WebAssembly module developers to create and use string references as a native data type. These string references are compatible with JavaScript strings and allow an easy interaction with JavaScript functions without the need to create copies or re-encoding at the language boundary. Specifically, these references are useful in conjunction with garbage collected WebAssembly (WasmGC) where the references nicely tie into the heap-based memory model. https://github.com/WebAssembly/stringref/blob/main/proposals/stringref/Overview.md

Motivation

Crossing the language boundary between WebAssembly and JavaScript often requires expensive re-encoding of strings making the crossings very expensive. By providing a copy-free mechanism, we can speed up applications that interact heavily with the JavaScript world. This also allow re-using existing JavaScript functionality like locale-aware string transformations or regular expressions that would otherwise be complex to implement.

Standards & signals

Ecosystem

Explainers: https://github.com/WebAssembly/stringref/blob/main/proposals/stringref/Overview.md

View on chromestatus.com