.Net: [MEVD] Use MemoryMarshal.TryGetArray to efficiently get arrays out of ReadOnlyMemory<float> #11770
Labels
msft.ext.vectordata
Related to Microsoft.Extensions.VectorData
.NET
Issue or Pull requests regarding .NET code
In most of our connectors, we currently do ToArray() on incoming
ReadOnlyMemory<float>
when serializing, since lower layers/SDKs frequently don't supportROM
. We should at least useMemoryMarshal.TryGetArray()
to unwrap the ROM when its wraps an entire array, rather than performing the extra allocation and copy. We can add an internal extension ofReadOnlyMemory<T>
which does this or falls back to ToArray().The text was updated successfully, but these errors were encountered: