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
I have a situation where I have some data sitting in a class that exposes access to a ReadOnlyMemory<bytes>. I'd like to be able to move the bytes directly from this into V8 via IArrayBuffer.WriteBytes, but I have to convert the ReadOnlyMemory to a byte[] and then copy that in. Would it be feasible to add a method like the following to IArrayBuffer?
In this example, the ReadOnlyMemory<byte> is backed by a managed array, but it could just as well refer to unmanaged memory. Here's how to copy data from the ReadOnlyMemory<byte> to the ArrayBuffer without creating an intermediate array:
I have a situation where I have some data sitting in a class that exposes access to a
ReadOnlyMemory<bytes>
. I'd like to be able to move the bytes directly from this into V8 viaIArrayBuffer.WriteBytes
, but I have to convert theReadOnlyMemory
to abyte[]
and then copy that in. Would it be feasible to add a method like the following toIArrayBuffer
?I believe the conversion from
ReadOnlyMemory
toReadOnlySpan
is fast and should avoid one copy of the byte array.I guess this is somewhat dependent on
WriteBytes
immediately writing the bytes from C# to V8 vs keeping a reference to the source around.This is not a high priority for me, just something I noticed today.
The text was updated successfully, but these errors were encountered: