Re: Tidy fill hstv array (src/backend/access/heap/pruneheap.c)

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Tidy fill hstv array (src/backend/access/heap/pruneheap.c)
Дата
Msg-id 20240304183355.4v3asob6ee4qxdkz@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Tidy fill hstv array (src/backend/access/heap/pruneheap.c)  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
Hi,

On 2024-03-04 08:47:11 -0300, Ranier Vilela wrote:
> Does filling a memory area, one by one, with branches, need strong evidence
> to prove that it is better than filling a memory area, all at once, without
> branches?

That's a bogus comparison:

a) the memset version modifies the whole array, rather than just elements that
   correspond to an item - often there will be far fewer items than the
   maximally possible number

b) the memset version initializes array elements that will be set to an actual
   value

c) switching to memset does not elide any branches, as the branch is still
   needed

And even without those, it'd still not be obviously better to use an
ahead-of-time memset(), as storing lots of values at once is more likely to be
bound by memory bandwidth than interleaving different work.

Andres



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: RFC: Logging plan of the running query
Следующее
От: Robert Haas
Дата:
Сообщение: Re: incremental backup mishandles XLOG_DBASE_CREATE_FILE_COPY