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.
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.
The length is already known and stored in the StringInfo's len field.
Not sure if this is the best name for this function, but can't think
of a better one right now.
0004: inlines appendStringInfoString so that any callers that pass in
a string constant (most of them) can have the strlen() call optimised
out.
I don't have any benchmarks to show workloads that this improves,
Likely the chances that it'll slow anything down are pretty remote.
I'll park this here until July.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services