Re: Re[2]: [PATCH] Change simple_heap_insert() to a macro - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re[2]: [PATCH] Change simple_heap_insert() to a macro
Date
Msg-id 2447.1539622838@sss.pgh.pa.us
Whole thread Raw
In response to Re[2]: [PATCH] Change simple_heap_insert() to a macro  (Andrey Klychkov <aaklychkov@mail.ru>)
List pgsql-hackers
=?UTF-8?B?QW5kcmV5IEtseWNoa292?= <aaklychkov@mail.ru> writes:
>>  simple_heap_insert() is used in catalog updates and such. Does that have
>>  any measurable performance impact?

> I guess this change doesn't give us an incredible performance increase except there will no redundant function call.
> I don't see any reasons against to use the proposed macro instead of this function.

Well, by the same token, there's no reason in favor either.

In this particular case I'd vote against because the macro requires
more side-knowledge than the function call, ie GetCurrentCommandId
has to be in-scope for every caller.  It's not hard to imagine
future changes that would make that problem worse.

In general, without a clearly measurable performance benefit,
changing functions into macros or inlines isn't a good idea.
The code churn poses hazards for back-patching, and there's
usually some physical code bloat due to more instructions being
needed at each call site.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: constraints names on partitions
Next
From: James Coleman
Date:
Subject: Error handling expectations