Re: Memory prefetching while sequentially fetching from SortTuple array, tuplestore

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Memory prefetching while sequentially fetching from SortTuple array, tuplestore
Дата
Msg-id CAM3SWZTtrY5ZZnEmPEZin9-AESC+-7nTQUm8G+7CnP7XyhJCdQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Memory prefetching while sequentially fetching from SortTuple array, tuplestore  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Memory prefetching while sequentially fetching from SortTuple array, tuplestore  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Thu, Jul 16, 2015 at 8:49 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Meh.  I don't like the assumption that non-GCC compilers will be smart
> enough to optimize away the useless-to-them if() tests this adds.
> Please refactor that so that there is exactly 0 new code when the
> intrinsic doesn't exist.

I imagined that there was some value in copying the GCC intrinsic's
behavior, and actually evaluating the "addr" expression even in the
event of no platform support. On reflection, I suppose that that isn't
actually a particularly useful property for Postgres. There will only
ever be a handful of callers.

Attached revision does not rely on such optimization occurring on
platforms that lack __builtin_prefetch(). This allowed me to decouple
availability from actual use, in the style of posix_fadvise(), so that
one can manually disable memory prefetching within pg_config_manual.h.

Clang is compatibile with __builtin_prefetch() intrinsic, FWIW. I'm
not sure if it's worth trying to make the wrapper portable across a
variety of supported compilers. If we were to attempt it, we would not
be the first. I note that ICC's memref_control has an identical
interface to __builtin_prefetch().

--
Peter Geoghegan

Вложения

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: TABLESAMPLE patch is really in pretty sad shape
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Arguable RLS security bug, EvalPlanQual() paranoia