See dotnet/coreclr#9539 (comment); doing if ((uint)index >= (uint)array.Length) { throw something; } will now elide the range check for array[index] afterwards. Probably won't yield a huge benefit in most placecs, but the perf gains would be essentially free. We should probably do this in collections that are backed by arrays, e.g. here is one place where the new JIT behavior could be put to use.
See dotnet/coreclr#9539 (comment); doing
if ((uint)index >= (uint)array.Length) { throw something; }will now elide the range check forarray[index]afterwards. Probably won't yield a huge benefit in most placecs, but the perf gains would be essentially free. We should probably do this in collections that are backed by arrays, e.g. here is one place where the new JIT behavior could be put to use.