~/talk

Writing (in)efficient C#

Talkat NDC Porto 2024 · 2024-10-14..10-18· [dotnet]
slides:none on file

Shows concrete inefficiencies and fixes: repeated enumeration and lazy IEnumerables cause multiple full iterations (demo reduces ~10–12 enumerations to one); List/array resizing doubles capacity (256 → 512) and wastes memory; add range avoids repeated resizes; async/Parallel and correct DI lifetimes cut work. Benchmarks use BenchmarkDotNet (string builder wins, “is” null checks beat Equals). Production tools include dotnet-counters, dotnet-dump, DotTrace/ANTS and Application Insights. Billion-row example drops from ~6 minutes to 2m then ~5s with low-level optimisations.

AI-written summary · about

  1. 0:00Introduction
  2. 4:22How .NET works
  3. 9:37Collection misuse
  4. 12:46Enumerators in .NET
  5. 17:21Array and list inefficiencies
  6. 23:24Live demo: inefficient patterns
  7. 35:25Parallel and async in .NET
  8. 39:38DI lifetimes and disposal
  9. 42:28Proper use of memory caches
  10. 45:25Benchmarking C# code
  11. 50:29Profiling tools
  12. 53:16Billion row challenge
  13. 57:11Resources
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.