From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ali Akbar <the(dot)apaan(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Function array_agg(array) |
Date: | 2014-11-25 23:22:27 |
Message-ID: | 24866.1416957747@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ali Akbar <the(dot)apaan(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ali Akbar | 2014-11-26 00:04:25 | Re: [REVIEW] Re: Fix xpath() to return namespace definitions |
Previous Message | Ali Akbar | 2014-11-25 23:15:00 | Re: Function array_agg(array) |