Benchmarks compare Yamux against raw TCP, the reference Go implementation, and Nerdbank.Streams.
System.IO.PipelinesBenchmarks should show:
dotnet run -c Release --project benchmarks/Yamux.Benchmark
The library is designed to minimize GC pressure:
ReusableValueTaskSourcePool pools TaskCompletionSource instances used for write completion signalingSystem.IO.Pipelines provides zero-copy buffer management for readingFrame struct is stack-allocated; payload ownership is tracked via IDisposableStreamIdGenerator uses Interlocked.Add for lock-free ID generationRemoteDataWindow uses pooled waiter objects for async flow controlMaxDataFrameSize — Larger frames reduce per-frame overhead but increase latency. Default 16KB.ReceiveWindowSize — Larger windows improve throughput for high-BDP connections. Default 256KB.AutoTuneReceiveWindowSize — Automatically scales window up to ReceiveWindowUpperBound based on RTT.ReceiveWindowUpperBound — Caps auto-tuning. Default 16MB.