Boosting memory management in interoperability scenarios
summary
Shows that replacing copies with Span<T> and Memory<T> and ref struct/ref returns cuts allocations and keeps safe access; benchmarks (run over about 1,001,000,000 iterations) put P/Invoke marshaling around ~12µs while raw IntPtr marshals are much slower. Demonstrates building a WAV-file processing pipeline using the new Pipelines API, chaining file readers, FFT transform blocks and writers, and streaming data without extra copies; the demo runs and produces correct output, with clear limits noted for stack-only types and async scenarios.
AI-written summary · about
chapters (9)
- 0:00Introduction and speaker background
- 3:57Interoperability challenges with WAV files
- 11:31Value types vs reference types in .NET
- 16:31Introducing ref struct and Span<T>
- 25:15Performance benchmarks for memory access
- 37:41Pipelines in ASP.NET Core
- 48:11Inter-process communication with pipes
- 53:14Chaining pipelines for transformations
- 59:53Demo and conclusion
related talks
51mSpanification
01h 04mTurbocharged: Writing High-Performance C# and .NET Code
59mHigh-performance code design patterns in C#
52mPerformance features in C#
01h 14mTurbocharged: Writing High-performance C# and .NET code
58mManual memory management in .NET Framework
48mManual Memory Management in .NET Framework
56mState of the .NET Performance
