ctaggart / froto

Froto: F# Protocol Buffers
MIT License
146 stars 27 forks source link

Span<T> #77

Open ctaggart opened 6 years ago

ctaggart commented 6 years ago

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

Span 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

jhugard commented 6 years ago

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.

ctaggart commented 6 years ago

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 commented 6 years ago

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/

jhugard commented 6 years ago

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...