You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider this function that writes a given object to a SharedArrayBuffer, using v8.serialize():
functionwrite(buffer,object,byteOffset=0){constdata=serialize(object)if(buffer.byteLength<data.byteLength+4+byteOffset){if(!buffer.growable){thrownewError('Buffer is not growable')}/* c8 ignore next 2 */buffer.grow(data.byteLength+4+byteOffset)}constview=newDataView(buffer,byteOffset)view.setUint32(0,data.byteLength,true)newUint8Array(buffer,byteOffset+4).set(data)}
This unfortunately causes a full copy of the object from the output of v8.serialize() into the target SharedArrayBuffer. If we could add a target, something like:
Consider this function that writes a given object to a SharedArrayBuffer, using
v8.serialize()
:This unfortunately causes a full copy of the object from the output of
v8.serialize()
into the targetSharedArrayBuffer
. If we could add a target, something like:We could save a full copy of the buffer in this way.
If growing as needed is not feasible, we could do:
The text was updated successfully, but these errors were encountered: