> Hmm, now that I look back at them I can't remember why I thought it is
> slower. Certainly using appendStringInfoCharMacro for every char is very
> slow, but I could probably use appendStringInfoString and it should be as
> fast as using the bytebuffer, they both do a straight forward memcpy.

This is what it does:

    appendStringInfoString(StringInfo str, const char *s)
        appendBinaryStringInfo(str, s, strlen(s));

Then it does the memcpy within appendBinaryStringInfo().  This is an extra 2
function calls, one of them a strlen() of the total contents of the string
to that point for every copy to the bytebuffer.  I'd expect this to be
slower for some of the use-cases we have.

If the StringInfo API were extended to use lengths...

- Luke

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not

Reply via email to