From 449d00bd3c5bfc7d4c1556ab8c8d76be19d5284c Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Wed, 22 Mar 2000 02:43:48 +0000 Subject: [PATCH] Bump up the intial hash table size in a bunch of places to avoid resizing the hash later. r=scc --- xpcom/components/nsGenericFactory.cpp | 2 +- xpcom/ds/nsAtomTable.cpp | 4 ++-- xpcom/ds/nsPersistentProperties.cpp | 2 +- xpcom/glue/nsGenericFactory.cpp | 2 +- xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp | 2 +- xpcom/typelib/xpt/src/xpt_xdr.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xpcom/components/nsGenericFactory.cpp b/xpcom/components/nsGenericFactory.cpp index 6f8699b9ad4..329b0cee3d6 100644 --- a/xpcom/components/nsGenericFactory.cpp +++ b/xpcom/components/nsGenericFactory.cpp @@ -111,7 +111,7 @@ nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount mModuleName(moduleName), mComponentCount(componentCount), mComponents(components), - mFactories(8, PR_FALSE), + mFactories(32, PR_FALSE), mDtor(dtor) { NS_INIT_ISUPPORTS(); diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index 4e79bf5a427..c8ea19f3876 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -148,7 +148,7 @@ NS_COM nsIAtom* NS_NewAtom(const PRUnichar* us) // Note: in a low memory condition, this routine could return |NULL| { if (nsnull == gAtomHashTable) { - gAtomHashTable = PL_NewHashTable(8, (PLHashFunction) HashKey, + gAtomHashTable = PL_NewHashTable(2048, (PLHashFunction) HashKey, (PLHashComparator) CompareKeys, (PLHashComparator) nsnull, nsnull, nsnull); @@ -166,7 +166,7 @@ NS_COM nsIAtom* NS_NewAtom(const PRUnichar* us) AtomImpl* id = new(us, uslen) AtomImpl(); if ( id ) { - PL_HashTableRawAdd(gAtomHashTable, hep, hashCode, id->mString, id); + PL_HashTableRawAdd(gAtomHashTable, hep, hashCode, id->mString, id); NS_ADDREF(id); } diff --git a/xpcom/ds/nsPersistentProperties.cpp b/xpcom/ds/nsPersistentProperties.cpp index b989344de34..4c6a5016a0b 100644 --- a/xpcom/ds/nsPersistentProperties.cpp +++ b/xpcom/ds/nsPersistentProperties.cpp @@ -50,7 +50,7 @@ nsPersistentProperties::nsPersistentProperties() mIn = nsnull; mSubclass = NS_STATIC_CAST(nsIPersistentProperties*, this); - mTable = PL_NewHashTable(8, (PLHashFunction) HashKey, + mTable = PL_NewHashTable(128, (PLHashFunction) HashKey, (PLHashComparator) CompareKeys, (PLHashComparator) nsnull, nsnull, nsnull); } diff --git a/xpcom/glue/nsGenericFactory.cpp b/xpcom/glue/nsGenericFactory.cpp index 6f8699b9ad4..329b0cee3d6 100644 --- a/xpcom/glue/nsGenericFactory.cpp +++ b/xpcom/glue/nsGenericFactory.cpp @@ -111,7 +111,7 @@ nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount mModuleName(moduleName), mComponentCount(componentCount), mComponents(components), - mFactories(8, PR_FALSE), + mFactories(32, PR_FALSE), mDtor(dtor) { NS_INIT_ISUPPORTS(); diff --git a/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp index 65ed19f4c1d..210d51215bc 100644 --- a/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/nsInterfaceInfoManager.cpp @@ -265,7 +265,7 @@ nsInterfaceInfoManager::indexify_file(const nsFileSpec *fileSpec) } // as many InterfaceDirectoryEntries as we expect to see. -#define XPT_HASHSIZE 64 +#define XPT_HASHSIZE 512 #ifdef DEBUG_iim static PRIntn diff --git a/xpcom/typelib/xpt/src/xpt_xdr.c b/xpcom/typelib/xpt/src/xpt_xdr.c index 0786b5c00b2..d117e3b96cf 100644 --- a/xpcom/typelib/xpt/src/xpt_xdr.c +++ b/xpcom/typelib/xpt/src/xpt_xdr.c @@ -92,7 +92,7 @@ typedef struct XPTHashRecord { struct XPTHashRecord *next; } XPTHashRecord; -#define XPT_HASHSIZE 32 +#define XPT_HASHSIZE 512 struct XPTHashTable { /* it's already typedef'ed from before. */ XPTHashRecord *buckets[XPT_HASHSIZE];