pgsql: Small improvements for allocation logic in ginHeapTupleFastColle

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Small improvements for allocation logic in ginHeapTupleFastColle
Date: 2018-12-19 16:41:42
Message-ID: E1gZeuk-0006yo-Lz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Small improvements for allocation logic in ginHeapTupleFastCollect().

Avoid repetitive calls to repalloc() when the required size of the
collector array grows more than 2x in one call. Also ensure that the
array size is a power of 2 (since palloc will probably consume a power
of 2 anyway) and doesn't start out very small (which'd likely just lead
to extra repallocs).

David Rowley, tweaked a bit by me

Discussion: https://postgr.es/m/CAKJS1f8vn-iSBE8PKeVHrnhvyjRNYCxguPFFY08QLYmjWG9hPQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c6e394c1a2ae641724d285ce0b043b753406dbbd

Modified Files
--------------
src/backend/access/gin/ginfast.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-12-19 17:53:48 pgsql: Remove function names from error messages
Previous Message Tom Lane 2018-12-19 16:02:19 pgsql: Doc: fix incorrect example of collecting arguments with fmgr mac