In the slides posted by pjmlp[0], I found one slide particularly interesting: Slide 38 about Contracts:
Contract.Requires(buffer != null);
Contract.Requires(
Range.IsValid(index, count, buffer.Length)
);
or the Debug variant of it : Contract.Debug.Requires/Assert/Fail
It reminds me of the Dafny programming language[1], but here this seems to be used for performance. The future C# AoT compiler could be validating those Contracts, and from these Contracts enables more aggressive optimizationsThe slide about PackN (and future "Safe" stackallock) is also great, it seems like the easiest optimization someone can apply to its current code.:
int[] array = new int[8] { 0, ..., 7 };
// Heap allocation! For short-lived arrays, this is bad!
Versus the proposed "Safe": Span<int> span = stackalloc int[8] { 0, ..., 7 };
[0] https://qconnewyork.com/system/files/presentation-slides/csy...