Re: Patch to improve a few appendStringInfo* calls

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to improve a few appendStringInfo* calls
Date: 2015-12-22 15:33:04
Message-ID: CA+Tgmobma9tyOP5R5Ujxkxzq0Fx0BAoCWn77TniV3cQ0G+8MkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 21, 2015 at 6:28 PM, David Rowley
<david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> According to grep -rE "appendStringInfoString\(.*\.data\);" . we have 13
> such matches. None of them seem to be in very performance critical places,
> perhaps with the exception of xmlconcat().
>
> Would you say that we should build a macro to wrap up a call to
> appendBinaryStringInfo() or invent another function which looks similar?

The macro probably would have a multiple evaluation hazard, so I'd be
inclined to invent a function. I mean, yeah, you could use a do { }
while (0) block to fix the multiple evaluation, but complex macros are
harder to read than functions, and not necessarily any faster.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yury Zhuravlev 2015-12-22 15:36:24 Re: Some questions about the array.
Previous Message Tom Lane 2015-12-22 15:29:26 Re: fix for readline terminal size problems when window is resized with open pager