vezel-dev / cathode

A terminal-centric replacement for the .NET console APIs.
https://docs.vezel.dev/cathode
BSD Zero Clause License
91 stars 7 forks source link

Switch to `FileStream`/`RandomAccess` for I/O if feasible (.NET 9+) #76

Open alexrp opened 2 years ago

alexrp commented 2 years ago

A number of improvements were made to FileStream in .NET 6: https://devblogs.microsoft.com/dotnet/file-io-improvements-in-dotnet-6

FileStream is now looking like a more attractive option for I/O compared to the hand-rolled interop we do right now.

That said, there are three major issues:

The (eventual) benefits of the switch would be improved performance, 'free' support for OS-native asynchronous operations, cancellation support, and more maintainable terminal driver code.

alexrp commented 7 months ago

Started an upstream discussion regarding Unix cancellation: https://github.com/dotnet/runtime/issues/96530

alexrp commented 7 months ago

https://github.com/dotnet/runtime/pull/96711