diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-09-02 16:44:58 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-09-02 16:45:30 +0200 |
commit | ec64e1d7bd230a172abfc37724d16af92d5fd37d (patch) | |
tree | 08e6918041bfd9811f4fa7a36523f1bcbffcb021 /src/shared/cplusplus | |
parent | 15b0082b3a34e3a7068f5ee2dbbc9ab1046c7ba2 (diff) | |
download | qt-creator-ec64e1d7bd230a172abfc37724d16af92d5fd37d.tar.gz |
Tune the symbol and the literal tables.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r-- | src/shared/cplusplus/LiteralTable.h | 12 | ||||
-rw-r--r-- | src/shared/cplusplus/Scope.cpp | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/shared/cplusplus/LiteralTable.h b/src/shared/cplusplus/LiteralTable.h index 1c85c6f13a..f95b79a7e6 100644 --- a/src/shared/cplusplus/LiteralTable.h +++ b/src/shared/cplusplus/LiteralTable.h @@ -138,7 +138,11 @@ public: _Literal *literal = new _Literal(chars, size); if (++_literalCount == _allocatedLiterals) { - _allocatedLiterals += 32; + if (! _allocatedLiterals) + _allocatedLiterals = 4; + else + _allocatedLiterals <<= 1; + _literals = (_Literal **) std::realloc(_literals, sizeof(_Literal *) * _allocatedLiterals); } @@ -161,7 +165,11 @@ protected: if (_buckets) std::free(_buckets); - _allocatedBuckets += 32; + if (! _allocatedBuckets) + _allocatedBuckets = 4; + else + _allocatedBuckets <<= 1; + _buckets = (_Literal **) std::calloc(_allocatedBuckets, sizeof(_Literal *)); _Literal **lastLiteral = _literals + (_literalCount + 1); diff --git a/src/shared/cplusplus/Scope.cpp b/src/shared/cplusplus/Scope.cpp index bc5eeb90bb..b500f178cb 100644 --- a/src/shared/cplusplus/Scope.cpp +++ b/src/shared/cplusplus/Scope.cpp @@ -105,7 +105,7 @@ private: void rehash(); private: - enum { DefaultInitialSize = 11 }; + enum { DefaultInitialSize = 4 }; Scope *_owner; Symbol **_symbols; @@ -147,7 +147,7 @@ void SymbolTable::enterSymbol(Symbol *symbol) symbol->_scope = _owner; _symbols[_symbolCount] = symbol; - if (_symbolCount >= _hashSize * 0.6) + if (_symbolCount * 5 >= _hashSize * 3) rehash(); else { const unsigned h = hashValue(symbol); |