Experiment 03 · Transferable objects
The Browser uses the structured clone algorithm to pass data in/out of Workers; it
supports complex data types, such as File, Blob,
ArrayBuffer, but the copy can take hundreds of milliseconds for
large objects. Transferable objects can be transfered from one context to the other; it
is a zero-copy.
In this experiment, we apply different filters to copies of a source image, the heavy-lifting
of the filtering is delegated to a worker, and the ImageData is passed in/out as a Transferable object. We wanted to
check whether or not it works in different desktop and mobile browsers – it seems well supported.
Source image
Filtered images
Supported by Safari 12 and Firefox 64 and Chrome 71 out-of-the box.