It's a little hard to read (due to the use of "ref" everywhere for raw pointer arithmetic), but that implements the use of vectorized min/max instructions to find the max of elements in an array (or any span), comparing them N at a time rather than 1 at a time.
If you don't call "new", and are careful to call non-allocating functions, and pass everything by reference, then the GC is irrelevant.
Obviously you only bother to do this at the very bottom of your flame graph in the hottest spots.
https://source.dot.net/#System.Linq/System/Linq/MaxMin.cs,70
It's a little hard to read (due to the use of "ref" everywhere for raw pointer arithmetic), but that implements the use of vectorized min/max instructions to find the max of elements in an array (or any span), comparing them N at a time rather than 1 at a time.
If you don't call "new", and are careful to call non-allocating functions, and pass everything by reference, then the GC is irrelevant.
Obviously you only bother to do this at the very bottom of your flame graph in the hottest spots.