-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Labels
Description
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
?
ulong WriteBytes(
ReadOnlySpan<byte> source,
ulong offset
)
I believe the conversion from ReadOnlyMemory
to ReadOnlySpan
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.