Re: Add new for_each macros for iterating over a List that do not require ListCell pointer

Поиск
Список
Период
Сортировка
От Jelte Fennema-Nio
Тема Re: Add new for_each macros for iterating over a List that do not require ListCell pointer
Дата
Msg-id CAGECzQSZf8OF++D5kpsd35KZb3ibbo_X0rt3c6NuiHJ2+4uw6w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add new for_each macros for iterating over a List that do not require ListCell pointer  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Add new for_each macros for iterating over a List that do not require ListCell pointer  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
On Wed, 3 Jan 2024 at 23:13, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I like Nathan's wording.

To be clear, I don't want to block this patch on the wording of that
single comment. So, if you feel Nathan's wording was better, I'm fine
with that too. But let me respond to your arguments anyway:

> Your assertion is contradicted by cases as
> obvious as -O0

My suggestion specifically mentions optimizing compilers, -O0 is by
definition not an optimizing compiler.

> just how far back might gcc choose to do that unrolling?

gcc 5.1 and clang 3.0 (possibly earlier, but this is the oldest I was
able to test the code with on godbolt). As seen upthread:

> I did some testing on godbolt.org and both versions of the macros
> result in the same assembly when compiling with -O2 (and even -O1)
> when compiling with ancient versions of gcc (5.1) and clang (3.0):
> https://godbolt.org/z/WqfTbhe4e

> Does the size of the loop body matter?)

I copy pasted a simple printf ~800 times and the answer seems to be
no, it doesn't matter: https://godbolt.org/z/EahYPa8KM



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Add new for_each macros for iterating over a List that do not require ListCell pointer
Следующее
От: Matthias van de Meent
Дата:
Сообщение: Re: Reducing output size of nodeToString