Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)
Дата
Msg-id CAApHDvqoZ8dCSuWF60hL=EPHNr5riRvbZ6YP6wyj-fu5K0gV9Q@mail.gmail.com
обсуждение исходный текст
Ответ на Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
On Wed, 27 Sept 2023 at 01:31, Ranier Vilela <ranier.vf@gmail.com> wrote:
> It seems to me that it adds a LEA instruction.
> https://godbolt.org/z/b4jK3PErE

There's a fairly significant difference in the optimisability of a
comparison with a compile-time constant vs a variable. For example,
would you expect the compiler to emit assembly for each side of the
boolean AND in: if (a > 12 && a > 20),  or how about if (a > 12 && a >
y)?  No need to answer. Just consider it.

I suggest keeping your experiments as close to the target code as
practical. You might be surprised by what the compiler can optimise.

David



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

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Avoid a possible out-of-bounds access (src/backend/optimizer/util/relnode.c)
Следующее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: Add test module for Table Access Method