Results in a ~2% performance increase by using the powerpc fls() implementation.
Signed-off-by: Jeremy Kerr <j...@ozlabs.org> --- src/backend/utils/mmgr/aset.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 0e2d4d5..762cf72 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -65,6 +65,7 @@ #include "postgres.h" #include "utils/memutils.h" +#include "utils/bitops.h" /* Define this to detail debug alloc information */ /* #define HAVE_ALLOCINFO */ @@ -270,12 +271,7 @@ AllocSetFreeIndex(Size size) if (size > 0) { - size = (size - 1) >> ALLOC_MINBITS; - while (size != 0) - { - idx++; - size >>= 1; - } + idx = fls((size - 1) >> ALLOC_MINBITS); Assert(idx < ALLOCSET_NUM_FREELISTS); } -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers