From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | appendStringInfoString() micro-opt |
Date: | 2004-01-25 03:43:06 |
Message-ID: | 87y8rwae2d.fsf@mailbox.samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
This patch replaces a bunch of call sites of appendStringInfo() with
appendStringInfoString(). (For those without the code in front of
you, the difference between these two functions is that the former
takes a sprintf-style format string and a variable list of arguments,
whereas the latter just takes a single NUL-terminated string;
therefore, the latter is faster if you're just appending a single
string to the buffer).
For the sake of minimizing how much of my time I've wasted if someone
objects, this patch only changes a portion of the call sites that
could be changed; I'll do the rest before committing the patch.
I was tempted to make appendStringInfoString() a macro, since (a) it's
just one line of code (b) I'd expect plenty of compilers to be smart
enough to optimize-out a strlen() on a string-literal arg. The
downside is that it would require that appendStringInfoString()
evaluate its arguments more than once. Any comments on whether this is
worth doing?
Unless anyone objects, I intend to apply the full version of this
patch within 48 hours.
-Neil
Attachment | Content-Type | Size |
---|---|---|
append-string-opt-3.patch | text/x-patch | 17.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2004-01-25 04:03:23 | next draft of list rewrite |
Previous Message | Tom Lane | 2004-01-24 23:45:44 | Re: Show function parameter names in information schema |