Re: Cleaning up and speeding up string functions - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Cleaning up and speeding up string functions
Date
Msg-id 31536.1558803042@sss.pgh.pa.us
Whole thread Raw
In response to Cleaning up and speeding up string functions  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Cleaning up and speeding up string functions
Re: Cleaning up and speeding up string functions
List pgsql-hackers
David Rowley <david.rowley@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: POC: converting Lists into arrays
Next
From: Alexander Lakhin
Date:
Subject: Fix inconsistencies for v12