From a69b183c4b34b7b22d51837c1ed132365f007503 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Sat, 23 May 2015 04:56:33 -0400 Subject: [PATCH] Make ConcurrentDictionary calls to TryUpdate use TryUpdateInternal Avoids recomputing the key's hashcode. --- .../src/System/Collections/Concurrent/ConcurrentDictionary.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs index 212d5f44196c..a600daf14512 100644 --- a/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs +++ b/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs @@ -1033,7 +1033,7 @@ public TValue AddOrUpdate(TKey key, Func addValueFactory, Func //key exists, try to update { TValue newValue = updateValueFactory(key, oldValue); - if (TryUpdate(key, newValue, oldValue)) + if (TryUpdateInternal(key, hashcode, newValue, oldValue)) { return newValue; }