зеркало из https://github.com/mozilla/gecko-dev.git
change array growth algorithm to reduce allocs and copies r=alecf,sr=waterson 59279
This commit is contained in:
Родитель
0559fe323e
Коммит
4b89209619
|
@ -159,8 +159,10 @@ morkArray::Grow(morkEnv* ev, mork_size inNewSize)
|
|||
{
|
||||
if ( mArray_Fill <= mArray_Size ) // fill and size fit the invariant?
|
||||
{
|
||||
if ( inNewSize - mArray_Size < 3 ) // actually want a few more slots?
|
||||
if (mArray_Size <= 3)
|
||||
inNewSize = mArray_Size + 3;
|
||||
else
|
||||
inNewSize = mArray_Size * 2;// + 3; // try doubling size here - used to grow by 3
|
||||
|
||||
mdb_size newByteSize = inNewSize * sizeof(void*);
|
||||
void** newBlock = 0;
|
||||
|
|
|
@ -500,7 +500,7 @@ mork_bool morkMap::grow(morkEnv* ev)
|
|||
{
|
||||
if ( mMap_Heap ) /* can we grow the map? */
|
||||
{
|
||||
mork_num newSlots = ((mMap_Slots * 4) / 3) + 1; /* +33% */
|
||||
mork_num newSlots = (mMap_Slots * 2); /* +100% */
|
||||
morkHashArrays old; /* a place to temporarily hold all the old arrays */
|
||||
if ( this->new_arrays(ev, &old, newSlots) ) /* have more? */
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче