tgnm commented on pull request #1358: URL: https://github.com/apache/avro/pull/1358#issuecomment-938610523
@Indomitable the reason why I force the abstract class to use `int` is because arrays in .NET don't exceed 2GB in size, unless `gcAllowVeryLargeObjects` is set. Regardless, the indexer on the array is `int`. If we look at more recent .NET APIs, even the new `Span<T>` type doesn't support a 64-bit length (for the reasons described here: https://github.com/dotnet/apireviews/tree/main/2016/11-04-SpanOfT). Finally, the library itself doesn't support block sizes exceeding 32-bit: ``` _blockSize = _decoder.ReadLong(); // read block size if (_blockSize > System.Int32.MaxValue || _blockSize < 0) { throw new AvroRuntimeException("Block size invalid or too large for this " + "implementation: " + _blockSize); ``` So having a long length isn't actually possible and would otherwise be misleading for people implementing `Codec`. Having said this, I'd like to see the library adopting the new Memory<T> and Span<T> APIs. There's a lot of opportunities for performance improvements and modernising the API of this library. However, this is out of scope for the issue I've raised and PR :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
