Re: remove redundant check of item pointer

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: remove redundant check of item pointer
Дата
Msg-id 388047.1651073669@sss.pgh.pa.us
обсуждение исходный текст
Ответ на remove redundant check of item pointer  (Junwang Zhao <zhjwpku@gmail.com>)
Ответы Re: remove redundant check of item pointer  (Junwang Zhao <zhjwpku@gmail.com>)
Список pgsql-hackers
Junwang Zhao <zhjwpku@gmail.com> writes:
> In function ItemPointerEquals, the ItemPointerGetBlockNumber
> already checked the ItemPointer if valid, there is no need
> to check it again in ItemPointerGetOffset, so use
> ItemPointerGetOffsetNumberNoCheck instead.

I do not think this change is worth making.  The point of
ItemPointerGetOffsetNumberNoCheck is not to save some cycles,
it's to be able to fetch the offset field in cases where it might
validly be zero.  The assertion will be compiled out anyway in
production builds --- and even in assert-enabled builds, I'd kind
of expect the compiler to optimize away the duplicated tests.

            regards, tom lane



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

Предыдущее
От: Junwang Zhao
Дата:
Сообщение: remove redundant check of item pointer
Следующее
От: Tom Lane
Дата:
Сообщение: Unstable tests for recovery conflict handling