.NET 5 Preview 2


Here are some of the improvements in Preview 2.

Code quality improvements in RyuJIT

Every release includes a set of changes that improve the machine code that the JIT generates, which is also known as "code quality". Better code quality means better performance. In summary, about half of the following improvements are actual new optimizations, and the other half are due to changing the flow of RyuJIT to enable existing optimizations to apply to more code patterns.

Garbage Collector

  • Card mark stealing: Server GC (on different threads) can now work-steal while marking gen0/1 objects held live by older generation objects. This means that ephemeral GC pauses are shorter for scenarios where some GC threads took much longer to mark than others.
  • Introducing Pinned Object Heap: Implemented part of the POH (Pinned Object Heap) feature – the part internal to GC. This new heap (essentially a peer to LOH) will allow the GC to manage pinned objects separately, and as a result, avoid the negative effects of pinned objects on the generational heaps.
  • Allow allocating large object from the free list while background sweeping SOH: Enabled LOH allocations using the free list while BGC is sweeping SOH. Previously this was only using the end of segment space on LOH. This allowed for better heap usage.
  • Background GC suspension fixes: Suspension fixes to reduce the time for both BGC and user threads to be suspended. This reduces the total time it takes to suspend managed threads before a GC can happen.
  • Fix named cgroup handling in docker: Added support to read limits from named cgroups. Previously we only read from the global one.