From 6710686f2890b4a62c969a2d8a45368027b1e33b Mon Sep 17 00:00:00 2001 From: zoltan Date: Wed, 4 Feb 2009 20:24:35 +0000 Subject: [PATCH] 2009-02-04 Zoltan Varga * Dictionary.cs: Declare the Link struct outside the main class to avoid creating a separate inflated instances for each instantiation of Dictionary. git-svn-id: svn+ssh://mono-cvs.ximian.com/source/trunk/mcs@125739 e3ebcda4-bce8-0310-ba0a-eca2169e7518 --- class/corlib/System.Collections.Generic/ChangeLog | 5 +++++ class/corlib/System.Collections.Generic/Dictionary.cs | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/class/corlib/System.Collections.Generic/ChangeLog b/class/corlib/System.Collections.Generic/ChangeLog index 77d7c5f078..4b9c654580 100644 --- a/class/corlib/System.Collections.Generic/ChangeLog +++ b/class/corlib/System.Collections.Generic/ChangeLog @@ -1,3 +1,8 @@ +2009-02-04 Zoltan Varga + + * Dictionary.cs: Declare the Link struct outside the main class to avoid + creating a separate inflated instances for each instantiation of Dictionary. + 2008-11-14 Jb Evain * Dictionary.cs (ICollection.CopyTo): fix the different possible diff --git a/class/corlib/System.Collections.Generic/Dictionary.cs b/class/corlib/System.Collections.Generic/Dictionary.cs index 6e415703fb..d400b4a0b1 100644 --- a/class/corlib/System.Collections.Generic/Dictionary.cs +++ b/class/corlib/System.Collections.Generic/Dictionary.cs @@ -43,6 +43,16 @@ using System.Security.Permissions; using System.Runtime.InteropServices; namespace System.Collections.Generic { + + /* + * Declare this outside the main class so it doesn't have to be inflated for each + * instantiation of Dictionary. + */ + internal struct Link { + public int HashCode; + public int Next; + } + [ComVisible(false)] [Serializable] public class Dictionary : IDictionary, @@ -73,11 +83,6 @@ namespace System.Collections.Generic { const float DEFAULT_LOAD_FACTOR = (90f / 100); const int NO_SLOT = -1; const int HASH_FLAG = -2147483648; - - private struct Link { - public int HashCode; - public int Next; - } // The hash table contains indices into the linkSlots array int [] table; -- 2.11.4.GIT