froto icon indicating copy to clipboard operation
froto copied to clipboard

Span<T>

Open ctaggart opened this issue 7 years ago • 4 comments

https://twitter.com/funcOfJoe/status/943671450677927936

Span<T> lands in .NET! We began this journey in Midori 10 years ago, a magical elixir of perf and safety. A heartfelt congratulations go out to the team for all the hard work shipping it, many of which stuck it out all these years. A labor of love! https://msdn.microsoft.com/en-us/magazine/mt814808?f=255&MSPPError=-2147217396

https://twitter.com/khellang/status/943778553111433216

One thing I was pleasantly surprised by is the how complete the span support is across the BCL now. Almost very single API that takes a byte array now supports spans ❤

I used the dotnet-core MyGet feed. Target netcoreapp2.1 and just pick a recent preview1 version for RuntimeFrameworkVersion 😊

cc @jhugard

ctaggart avatar Dec 21 '17 17:12 ctaggart

Nice replacement for ArraySegment with vastly superior utility - plays nice with all container types and enumerators. Could consider moving ZeroCopyBuffer, et al. to this, but that will break compat with older versions of mono, Unity and CLR.

jhugard avatar Apr 19 '18 15:04 jhugard

Introducing .NET Core 2.1 Flagship Types: Span T and Memory T https://www.codemag.com/Article/1807051/Introducing-.NET-Core-2.1-Flagship-Types-Span-T-and-Memory-T

ctaggart avatar Jun 29 '18 19:06 ctaggart

System.IO.Pipelines: High performance IO in .NET https://blogs.msdn.microsoft.com/dotnet/2018/07/09/system-io-pipelines-high-performance-io-in-net/

ctaggart avatar Jul 09 '18 20:07 ctaggart

Sweet! Shouldn't be too hard to replace ZeroCopyBuffer with PipeReader + PipeWriter and get far better buffer control (and probably better performance).

Note, though, that Unity has problems with SignelR on iOS. No idea if this carries over to System.IO.Pipelines. Note also that await support is required, so older Unity would be a non-starter.

LMK if there's strong interest. Maybe I can give it a go on a branch...

jhugard avatar Jul 10 '18 02:07 jhugard