Re: Cleaning up and speeding up string functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up and speeding up string functions
Date: 2019-05-25 16:50:42
Message-ID: 31536.1558803042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
> Here's a small patch series aimed to both clean up a few misuses of
> string functions and also to optimise a few things along the way.

> 0001: Converts various call that use appendPQExpBuffer() that really
> should use appendPQExrBufferStr(). If there's no formatting then
> using the former function is a waste of effort.

> 0002: Similar to 0001 but replaces various appendStringInfo calls with
> appendStringInfoString calls.

Agreed on these; we've applied such transformations before.

> 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.

> 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.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2019-05-25 20:50:09 Fix inconsistencies for v12
Previous Message Tom Lane 2019-05-25 16:46:19 Re: POC: converting Lists into arrays