Re: Cleaning up and speeding up string functions

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up and speeding up string functions
Date: 2019-05-25 23:00:41
Message-ID: CAKJS1f9vSN0tM-7Q2=pXX5vgY8mOPkuT9Enu01_SL2wdipH+gw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 26 May 2019 at 04:50, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
> > 0003: Adds a new function named appendStringInfoStringInfo() which
> > appends one StringInfo onto another. Various places did this using
> > appendStringInfoString(), but that required a needless strlen() call.
>
> I can't get excited about this one unless you can point to places
> where the savings is meaningful. Otherwise it's just adding mental
> burden.

The original idea was just to use appendBinaryStringInfo and make use
of the StringInfo's len field. Peter mentioned he'd rather seen a
wrapper function here [1].

> > 0004: inlines appendStringInfoString so that any callers that pass in
> > a string constant (most of them) can have the strlen() call optimised
> > out.
>
> Here the cost is code space rather than programmer-visible complexity,
> but I still doubt that it's worth it.

I see on today's master the postgres binary did grow from 8633960
bytes to 8642504 on my machine using GCC 8.3, so you might be right.
pg_receivewal grew from 96376 to 96424 bytes.

[1] https://www.postgresql.org/message-id/5567B7F5.7050705%40gmx.net

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jaime Casanova 2019-05-26 05:40:38 Re: This seems like very unfriendly behaviour
Previous Message Alexander Lakhin 2019-05-25 20:50:09 Fix inconsistencies for v12