Re: appendStringInfo vs appendStringInfoString
От | Heikki Linnakangas |
---|---|
Тема | Re: appendStringInfo vs appendStringInfoString |
Дата | |
Msg-id | 5246B961.50107@vmware.com обсуждение исходный текст |
Ответ на | appendStringInfo vs appendStringInfoString (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: appendStringInfo vs appendStringInfoString
Re: appendStringInfo vs appendStringInfoString Re: appendStringInfo vs appendStringInfoString |
Список | pgsql-hackers |
On 28.09.2013 12:44, David Rowley wrote: > The macro for test 4 was as follows: > #define appendStringInfoStringConst(buf, s) appendBinaryStringInfo(buf, > (s), sizeof(s)-1) If that makes any difference in practice, I wonder if we should just do: #define appendStringInfoString(buf, s) appendBinaryStringInfo(buf, (s), strlen(s)) With a compiler worth its salt, the strlen(s) will be optimized into a constant, if s is a constant. If it's not a constant, we'll just end up calling strlen(), like appendStringInfoString would anyway. That would turn a single function call into two in all of the non-constant callsites, though, bloating the code, so it might not be a win overall. - Heikki
В списке pgsql-hackers по дате отправления: