Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Small tweaks to Dict asm size (#17096)
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored and jkotas committed Mar 21, 2018
1 parent d488ef7 commit 06f6f87
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mscorlib/shared/System/Collections/Generic/Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ public void Clear()
_count = 0;
_freeList = -1;
_freeCount = 0;
_version++;
Array.Clear(_entries, 0, count);
}
_version++;
}

public bool ContainsKey(TKey key)
Expand Down Expand Up @@ -440,6 +440,7 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}

_version++;
if (_buckets == null)
{
Initialize(0);
Expand Down Expand Up @@ -471,7 +472,6 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
_version++;
return true;
}

Expand Down Expand Up @@ -509,7 +509,6 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
_version++;
return true;
}

Expand Down Expand Up @@ -571,7 +570,6 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior)
entry.value = value;
// Value in _buckets is 1-based
targetBucket = index + 1;
_version++;

// Value types never rehash
if (default(TKey) == null && collisionCount > HashHelpers.HashCollisionThreshold && comparer is NonRandomizedStringEqualityComparer)
Expand Down

0 comments on commit 06f6f87

Please sign in to comment.