Re: Re[2]: [PATCH] Change simple_heap_insert() to a macro

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Re[2]: [PATCH] Change simple_heap_insert() to a macro
Дата
Msg-id 2447.1539622838@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re[2]: [PATCH] Change simple_heap_insert() to a macro  (Andrey Klychkov <aaklychkov@mail.ru>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: constraints names on partitions
Следующее
От: James Coleman
Дата:
Сообщение: Error handling expectations