forked from qt-creator/qt-creator
Tune the symbol and the literal tables.
This commit is contained in:
@@ -138,7 +138,11 @@ public:
|
|||||||
_Literal *literal = new _Literal(chars, size);
|
_Literal *literal = new _Literal(chars, size);
|
||||||
|
|
||||||
if (++_literalCount == _allocatedLiterals) {
|
if (++_literalCount == _allocatedLiterals) {
|
||||||
_allocatedLiterals += 32;
|
if (! _allocatedLiterals)
|
||||||
|
_allocatedLiterals = 4;
|
||||||
|
else
|
||||||
|
_allocatedLiterals <<= 1;
|
||||||
|
|
||||||
_literals = (_Literal **) std::realloc(_literals, sizeof(_Literal *) * _allocatedLiterals);
|
_literals = (_Literal **) std::realloc(_literals, sizeof(_Literal *) * _allocatedLiterals);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +165,11 @@ protected:
|
|||||||
if (_buckets)
|
if (_buckets)
|
||||||
std::free(_buckets);
|
std::free(_buckets);
|
||||||
|
|
||||||
_allocatedBuckets += 32;
|
if (! _allocatedBuckets)
|
||||||
|
_allocatedBuckets = 4;
|
||||||
|
else
|
||||||
|
_allocatedBuckets <<= 1;
|
||||||
|
|
||||||
_buckets = (_Literal **) std::calloc(_allocatedBuckets, sizeof(_Literal *));
|
_buckets = (_Literal **) std::calloc(_allocatedBuckets, sizeof(_Literal *));
|
||||||
|
|
||||||
_Literal **lastLiteral = _literals + (_literalCount + 1);
|
_Literal **lastLiteral = _literals + (_literalCount + 1);
|
||||||
|
@@ -105,7 +105,7 @@ private:
|
|||||||
void rehash();
|
void rehash();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { DefaultInitialSize = 11 };
|
enum { DefaultInitialSize = 4 };
|
||||||
|
|
||||||
Scope *_owner;
|
Scope *_owner;
|
||||||
Symbol **_symbols;
|
Symbol **_symbols;
|
||||||
@@ -147,7 +147,7 @@ void SymbolTable::enterSymbol(Symbol *symbol)
|
|||||||
symbol->_scope = _owner;
|
symbol->_scope = _owner;
|
||||||
_symbols[_symbolCount] = symbol;
|
_symbols[_symbolCount] = symbol;
|
||||||
|
|
||||||
if (_symbolCount >= _hashSize * 0.6)
|
if (_symbolCount * 5 >= _hashSize * 3)
|
||||||
rehash();
|
rehash();
|
||||||
else {
|
else {
|
||||||
const unsigned h = hashValue(symbol);
|
const unsigned h = hashValue(symbol);
|
||||||
|
Reference in New Issue
Block a user