Ali Akbar <the.ap...@gmail.com> writes:
> Just curious, in accumArrayResultArr, while enlarging array and
> nullbitmaps, why it's implemented with:

> astate->abytes = Max(astate->abytes * 2,
> astate->nbytes + ndatabytes);
> and
> astate->aitems = Max(astate->aitems * 2, newnitems);

> won't it be more consistent if it's implemented just like in the first
> allocation?:

> while (astate->aitems <= newnitems)
> astate->aitems *= 2;

The idea was to try to force the initial allocation to be a power of 2,
while not insisting on that for later enlargements.  I can't point to any
hard reasons for doing it that way, but it seemed like a good idea.
Power-of-2 allocations are good up to a certain point but after that they
tend to get wasteful ...

                        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to