Make some Dictionary code smaller (dotnet/coreclr#10993)
authormikedn <onemihaid@hotmail.com>
Sat, 15 Apr 2017 19:11:51 +0000 (22:11 +0300)
committerJan Kotas <jkotas@microsoft.com>
Sat, 15 Apr 2017 19:11:51 +0000 (12:11 -0700)
commita0af3ac4b58e0bf20ffb21e2f4c33ae067a26844
tree4086d23dc869841996a21a75b6b837b5f74e111b
parent3e1f192cd44e6d49d285034e19214d1cc4d50134
Make some Dictionary code smaller (dotnet/coreclr#10993)

Store a reference to the relevant entry at the start of the loop to avoid indexing `entries` multiple times.
This avoids some redundant range checks in `Remove` and allows the elimination of a duplicate `index++` in `Enumerator.MoveNext`.

Saves ~7KB of code.

Commit migrated from https://github.com/dotnet/coreclr/commit/6cb9a6fa3d0902b54cf3e4216e0641b9cb47182b
src/coreclr/src/mscorlib/src/System/Collections/Generic/Dictionary.cs