appendStringInfoString() micro-opt

Поиск
Список
Период
Сортировка
От Neil Conway
Тема appendStringInfoString() micro-opt
Дата
Msg-id 87y8rwae2d.fsf@mailbox.samurai.com
обсуждение исходный текст
Ответы Re: appendStringInfoString() micro-opt  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Show function parameter names in information schema
Следующее
От: Neil Conway
Дата:
Сообщение: next draft of list rewrite