Skip to content
Cognate Press

C# at Cognate Press

C#

C#, .NET, and the runtime beneath them: the CLR, the JIT, the garbage collector and the frameworks built on top.

Published as CSharpMind at csharpmind.com, written by Callum Reeve — C#, .NET, and the runtime beneath them. First issue .

Every issue on C#

  1. In a dotnet-dump of a contested lock, clrstack -all marked no thread as the owner. syncblk named it, and a suspended await appeared only in dumpasync.

  2. Environment.ProcessorCount is the CPU quota rounded up, never below 1. The thread pool minimum follows it, and Server GC switches itself off at 1.

  3. Assigning a struct to an interface allocated 0 bytes. Passing it across a call boundary allocated 24. A constrained generic allocated none, until its body asked for an object.

  4. Removing UseRouting dropped per-request allocation by 2.29 KB in isolation — separated from authorization's share, routing itself costs about 24 bytes.

  5. A thread pool queue held at two thousand work items read 1986 through one provider and -13 through the other, in the same second, in the same process.

  6. Server GC finished 2.7 times faster and collected 17 times less often — and made the slowest request in the run 5 to 13 times slower. Both numbers are real.

  7. Blocking on a task is the case the thread pool compensates for. Blocking on a sleep or an event is the case it cannot see, and it finished 2.5 times slower.

  8. An async method that never suspends allocates nothing. The same method, suspended once, allocates 160 bytes. The cost is not the keyword — it is the suspension.

Archive at csharpmind.com ↗

The byline

Callum Reeve

The language and its lowering, the JIT’s decisions, and what garbage collection costs. Settles a claim against runtime source, a documented knob, or an experiment that states its SDK build.

Read the profile →

What the title covers

  • C#
  • .NET
  • CLR
  • JIT compilation
  • Garbage collection
  • async/await
  • ASP.NET Core
  • Diagnostics

The other languages in the imprint: PHP · JavaScript · Java · Python · SQL · Go. Each has one title and one byline behind it — the index is at Topics.