Re: Inlining comparators as a performance optimisation
| От | Greg Stark |
|---|---|
| Тема | Re: Inlining comparators as a performance optimisation |
| Дата | |
| Msg-id | CAM-w4HPw=A_weJVKpCHOTf-H9tu9AZNhY7Qfzf89-mnteuV8xA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Inlining comparators as a performance optimisation (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-hackers |
On Wed, Sep 21, 2011 at 5:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> None of that stuff is inlinable or constant-foldable today, nor would it
> be with the patch that Peter was proposing AFAICS, because none of the
> flags will ever be compile time constant values.
I was referring to transformations like this which I believe compilers
are already capable of doing:
v = ...;
while (...) if (v) { if (a < b) ... else ....; } else { if (a > b) ... else ...; }
turning it into code that looks like:
if (v) {while (....) if (a<b) ... else ...;
} else { while (....) if (a>b) ... else ...;
}
which may not look like much -- especially with branch prediction --
but then it's much more likely to be able to unroll the loop and do
clever instruction scheduling and so on than if there's an extra
branch in the middle of the loop. But if there's a function call to an
external function called through a function pointer in the middle of
the loop then the whole endeavour would be for naught.
--
greg
В списке pgsql-hackers по дате отправления: