From dotnet/coreclr#10203 (comment)
I have glanced over the native code generated for Dictionary<int,int>.Remove. The CSE for entry[i] kicks in some cases, but not others. If you cache ref Entry entry = ref entries[i]; at the start of the loop and replace all 9 occurrences of entries[i] with it, the native code generated for this method should be approximately 20% smaller.
From dotnet/coreclr#10203 (comment)
I have glanced over the native code generated for
Dictionary<int,int>.Remove. The CSE forentry[i]kicks in some cases, but not others. If you cacheref Entry entry = ref entries[i];at the start of the loop and replace all 9 occurrences ofentries[i]with it, the native code generated for this method should be approximately 20% smaller.