~/talk

High-performance code design patterns in C#

Talkat Update Conference Prague 2019 · 2019-11-14..11-15· [dotnet]
slides:none on file

A practical checklist of concrete patterns and results: use Span<T> zero-copy and Memory<T> to slice without copying (used in Kestrel), rent buffers from ArrayPool/MemoryPool to cut allocations (benchmarks show almost 2x speed and near-zero allocations), prefer struct-of-arrays for hot loops (example yields ~10x speed), use stackalloc for tiny temporaries (≈33% faster, another ~10% if zeroing is skipped), and replace repeated string concatenation with buffer builders/stringbuilder (GC time drops ~60%→~15%, throughput rises ~9→150 rps).

AI-written summary · about

  1. 0:00Introduction
  2. 1:48Design patterns in C
  3. 7:26Collection
  4. 13:50Polling
  5. 18:47Zero Copy
  6. 26:54Array ofstructs
  7. 27:21Array of classes
  8. 29:52Array of arrays
  9. 32:56Entity component system
  10. 34:10Avoid the managed heap
  11. 34:32Fastest allocation
  12. 35:05structs
  13. 36:08stack a lock
  14. 36:45stack overflow exception
  15. 38:25temporary data
  16. 39:04runtime guarantee
  17. 40:12zeroing memory
  18. 40:29faster code
  19. 41:53stock log
  20. 43:00fixed size buffers
  21. 43:33stockbased data
  22. 43:50buffered builder
  23. 44:42string builder
  24. 45:46load test
  25. 46:41throughput
  26. 47:18Buffer builder
  27. 48:27Buffer buffered builders
  28. 49:18Memory usage
  29. 49:31Other patterns
  30. 50:31Questions
~/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.