зеркало из https://github.com/mozilla/pjs.git
Increase the initial sizes of hash tables that are guaranteed to grow. b=432633 r=dbaron
This commit is contained in:
Родитель
13a717e3a5
Коммит
7fd21a9c64
|
@ -449,6 +449,8 @@ nsScriptNameSpaceManager::RegisterInterface(const char* aIfName,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#define GLOBALNAME_HASHTABLE_INITIAL_SIZE 1024
|
||||
|
||||
nsresult
|
||||
nsScriptNameSpaceManager::Init()
|
||||
{
|
||||
|
@ -465,7 +467,8 @@ nsScriptNameSpaceManager::Init()
|
|||
};
|
||||
|
||||
mIsInitialized = PL_DHashTableInit(&mGlobalNames, &hash_table_ops, nsnull,
|
||||
sizeof(GlobalNameMapEntry), 128);
|
||||
sizeof(GlobalNameMapEntry),
|
||||
GLOBALNAME_HASHTABLE_INITIAL_SIZE);
|
||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
|
|
@ -192,12 +192,14 @@ static nsresult pref_DoCallback(const char* changed_pref);
|
|||
static nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, PRBool defaultPref);
|
||||
static inline PrefHashEntry* pref_HashTableLookup(const void *key);
|
||||
|
||||
#define PREF_HASHTABLE_INITIAL_SIZE 2048
|
||||
|
||||
nsresult PREF_Init()
|
||||
{
|
||||
if (!gHashTable.ops) {
|
||||
if (!PL_DHashTableInit(&gHashTable, &pref_HashTableOps, nsnull,
|
||||
sizeof(PrefHashEntry), 1024)) {
|
||||
sizeof(PrefHashEntry),
|
||||
PREF_HASHTABLE_INITIAL_SIZE)) {
|
||||
gHashTable.ops = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -599,6 +599,9 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
|||
mContractIDs.ops = nsnull;
|
||||
}
|
||||
|
||||
#define CONTRACTID_HASHTABLE_INITIAL_SIZE 2048
|
||||
#define AUTOREGENTRY_HASHTABLE_INITIAL_SIZE 256
|
||||
|
||||
nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
||||
PRUint32 aStaticModuleCount)
|
||||
{
|
||||
|
@ -634,7 +637,7 @@ nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
|||
if (!mContractIDs.ops) {
|
||||
if (!PL_DHashTableInit(&mContractIDs, &contractID_DHashTableOps,
|
||||
0, sizeof(nsContractIDTableEntry),
|
||||
1024)) {
|
||||
CONTRACTID_HASHTABLE_INITIAL_SIZE)) {
|
||||
mContractIDs.ops = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -648,7 +651,7 @@ nsresult nsComponentManagerImpl::Init(nsStaticModuleInfo const *aStaticModules,
|
|||
#endif
|
||||
}
|
||||
|
||||
if (!mAutoRegEntries.Init(32))
|
||||
if (!mAutoRegEntries.Init(AUTOREGENTRY_HASHTABLE_INITIAL_SIZE))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (mMon == nsnull) {
|
||||
|
|
|
@ -630,13 +630,15 @@ WrapStaticAtom(const nsStaticAtom* aAtom, PRUint32 aLength)
|
|||
return wrapper;
|
||||
}
|
||||
|
||||
#define ATOM_HASHTABLE_INITIAL_SIZE 4096
|
||||
|
||||
static inline AtomTableEntry*
|
||||
GetAtomHashEntry(const char* aString, PRUint32 aLength)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "wrong thread");
|
||||
if (!gAtomTable.ops &&
|
||||
!PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
sizeof(AtomTableEntry), 2048)) {
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_SIZE)) {
|
||||
gAtomTable.ops = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -652,7 +654,7 @@ GetAtomHashEntry(const PRUnichar* aString, PRUint32 aLength)
|
|||
NS_ASSERTION(NS_IsMainThread(), "wrong thread");
|
||||
if (!gAtomTable.ops &&
|
||||
!PL_DHashTableInit(&gAtomTable, &AtomTableOps, 0,
|
||||
sizeof(AtomTableEntry), 2048)) {
|
||||
sizeof(AtomTableEntry), ATOM_HASHTABLE_INITIAL_SIZE)) {
|
||||
gAtomTable.ops = nsnull;
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#define XPTI_STRING_ARENA_BLOCK_SIZE (1024 * 1)
|
||||
#define XPTI_STRUCT_ARENA_BLOCK_SIZE (1024 * 1)
|
||||
#define XPTI_HASHTABLE_SIZE 128
|
||||
#define XPTI_HASHTABLE_SIZE 2048
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче