summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2018-09-17 16:21:25 -0700
committerJan Kotas <jkotas@microsoft.com>2018-09-18 21:18:03 -0700
commita00a6eaca1d6d45235ed076b81a2169d08487e71 (patch)
treebc6a1d3c8c16dff8d4a0c42da4d4f4202f33da7f /src
parented9fb0d4cb56d0aaedf6b8e02b683d33b10a0f12 (diff)
downloadcoreclr-a00a6eaca1d6d45235ed076b81a2169d08487e71.tar.gz
coreclr-a00a6eaca1d6d45235ed076b81a2169d08487e71.tar.bz2
coreclr-a00a6eaca1d6d45235ed076b81a2169d08487e71.zip
* Revert the changes to TryInsert() introduced by https://github.com/dotnet/coreclr/pull/17096 completely, which only showed modest size improvement
* Removing the _version increment from Clear() entirely to bring it in line with the behavior in Remove() and to keep size gains [tfs-changeset: 1714543] Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
index bc3040771f..47105651da 100644
--- a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
+++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs
@@ -267,7 +267,6 @@ namespace System.Collections.Generic
_freeCount = 0;
Array.Clear(_entries, 0, count);
}
- _version++;
}
public bool ContainsKey(TKey key)
@@ -476,7 +475,6 @@ namespace System.Collections.Generic
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
}
- _version++;
if (_buckets == null)
{
Initialize(0);
@@ -511,6 +509,7 @@ namespace System.Collections.Generic
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
+ _version++;
return true;
}
@@ -552,6 +551,7 @@ namespace System.Collections.Generic
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
+ _version++;
return true;
}
@@ -590,6 +590,7 @@ namespace System.Collections.Generic
if (behavior == InsertionBehavior.OverwriteExisting)
{
entries[i].value = value;
+ _version++;
return true;
}
@@ -647,6 +648,7 @@ namespace System.Collections.Generic
entry.value = value;
// Value in _buckets is 1-based
bucket = index + 1;
+ _version++;
// Value types never rehash
if (default(TKey) == null && collisionCount > HashHelpers.HashCollisionThreshold && comparer is NonRandomizedStringEqualityComparer)