Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Writing Allocation Free Code in C#

NDC Conferences via YouTube

Overview

Explore techniques for improving C# code performance by reducing memory allocations in this one-hour conference talk. Learn about using structs efficiently, understand the differences between classes and structs, and discover the benefits of the Span runtime type for working with memory slices. Examine recent C# features that enable allocation-free coding, including ref returns, readonly structs, and ref structs. Dive into practical examples using System.Text.Json and micro-benchmarks to measure performance improvements. Gain insights on when to apply these techniques and when to avoid them, ensuring optimal code performance without sacrificing readability or maintainability.

Syllabus

Introduction
Garbage Collection
LowHanging Fruit
Reference Types and Value Types
Closures and Iterators
Value Types
Ref Returns
Ref ReadOnly
Method Argument Modifier
ReadOnly struct
Ref structs
SystemTextJason
Micro Benchmarks
Summary

Taught by

NDC Conferences

Reviews

Start your review of Writing Allocation Free Code in C#

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.