From: | David Rowley <dgrowleyml(at)gmail(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: appendPQExpBufferVA vs appendStringInfoVA |
Date: | 2013-11-02 14:18:22 |
Message-ID: | CAApHDvqkNZ3s-0dxGQtaOx37mqfKeHp7s_LB1=oBuSJGdy=Yzw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Nov 2, 2013 at 2:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> > Tom commited some changes to appendStringInfoVA a few weeks ago which
> > allows it to return the required buffer size if the current buffer is not
> > big enough.
>
> > On looking at appendPQExpBufferVA I'm thinking it would be nice if it
> could
> > make use of the new pvsnprintf function to bring the same potential
> > performance improvement in to there too.
>
> Uh ... it does contain pretty much the same algorithm now. We can't
> simply use pvsnprintf there because exit-on-error is no good for
> libpq's purposes, so unless we want to rethink that, a certain
> amount of code duplication is unavoidable. But they both understand
> about C99 vsnprintf semantics now.
>
>
I only just noticed the changes you made to appendPQExpBufferVA().
I had wondered if making pvsnprintf return int instead of size_t and having
it return -1 if there are problems, then letting the caller deal with
those, but I'm starting to see why you did it the way you did it... There's
also quite a few subtle differences with things like max allocation size
that would have to be dealt with differently I guess.
I'm low on ideas on how to improve things much around here for now, but for
what it's worth, I did create a patch which changes unnecessary calls to
appendPQExpBuffer() into calls to appendPQExpBufferStr() similar to the
recent one for appendStringInfo and appendStringInfoString.
Regards
David Rowley
regards, tom lane
>
Attachment | Content-Type | Size |
---|---|---|
appendPQExpBufferStr_v0.1.patch.gz | application/x-gzip | 24.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2013-11-02 14:46:15 | Re: Record comparison compiler warning |
Previous Message | Atri Sharma | 2013-11-02 10:54:58 | Re: Handle LIMIT/OFFSET before select clause (was: Feature request: optimizer improvement) |