Обсуждение: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

Поиск
Список
Период
Сортировка

[COMMITTERS] pgsql: Add more efficient functions to pqformat API.

От
Andres Freund
Дата:
Add more efficient functions to pqformat API.

There's three prongs to achieve greater efficiency here:

1) Allow reusing a stringbuffer across pq_beginmessage/endmessage,  with the new
pq_beginmessage_reuse/endmessage_reuse.This can be  beneficial both because it avoids allocating the initial buffer,
andbecause it's more likely to already have an correctly sized  buffer. 

2) Replacing pq_sendint() with pq_sendint$width() inline  functions. Previously unnecessary and unpredictable branches
in pq_sendint() were needed. Additionally the replacement functions  are implemented more efficiently.  pq_sendint is
nowdeprecated, a  separate commit will convert all in-tree callers. 

3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient  space in the StringInfo's buffer, avoiding
individualspace checks  & potential individual resizing.  To allow this to be used for  strings, expose mbutil.c's
MAX_CONVERSION_GROWTH.

Followup commits will make use of these facilities.

Author: Andres Freund
Discussion: https://postgr.es/m/20170914063418.sckdzgjfrsbekae4@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1de09ad8eb1fa673ee7899d6dfbb2b49ba204818

Modified Files
--------------
src/backend/libpq/pqformat.c   |  88 ++++++++-------------
src/backend/utils/mb/mbutils.c |  11 ---
src/include/libpq/pqformat.h   | 168 ++++++++++++++++++++++++++++++++++++++++-
src/include/mb/pg_wchar.h      |  11 +++
4 files changed, 208 insertions(+), 70 deletions(-)


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

Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

От
Peter Eisentraut
Дата:
On 10/11/17 19:11, Andres Freund wrote:
> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient
>    space in the StringInfo's buffer, avoiding individual space checks
>    & potential individual resizing.  To allow this to be used for
>    strings, expose mbutil.c's MAX_CONVERSION_GROWTH.

This has been causing warnings from cpluspluscheck.  I suggest the
attached patch to address that.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

От
Peter Eisentraut
Дата:
On 11/30/17 14:49, Peter Eisentraut wrote:
> On 10/11/17 19:11, Andres Freund wrote:
>> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient
>>    space in the StringInfo's buffer, avoiding individual space checks
>>    & potential individual resizing.  To allow this to be used for
>>    strings, expose mbutil.c's MAX_CONVERSION_GROWTH.
> 
> This has been causing warnings from cpluspluscheck.  I suggest the
> attached patch to address that.

committed

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: [COMMITTERS] pgsql: Add more efficient functions to pqformat API.

От
Andres Freund
Дата:
On 2017-12-04 19:58:01 -0500, Peter Eisentraut wrote:
> On 11/30/17 14:49, Peter Eisentraut wrote:
> > On 10/11/17 19:11, Andres Freund wrote:
> >> 3) Add pq_writeint$width(), pq_writestring(). These rely on sufficient
> >>    space in the StringInfo's buffer, avoiding individual space checks
> >>    & potential individual resizing.  To allow this to be used for
> >>    strings, expose mbutil.c's MAX_CONVERSION_GROWTH.
> > 
> > This has been causing warnings from cpluspluscheck.  I suggest the
> > attached patch to address that.
> 
> committed

Thanks!

Greetings,

Andres Freund