[PATCH 2/2] Use fls() to find chunk set
От | Jeremy Kerr |
---|---|
Тема | [PATCH 2/2] Use fls() to find chunk set |
Дата | |
Msg-id | 1243957479.379718.764595571686.2.gpush@pingu обсуждение исходный текст |
Ответ на | Re: faster version of AllocSetFreeIndex for x86 architecture (Jeremy Kerr <jk@ozlabs.org>) |
Список | pgsql-hackers |
Results in a ~2% performance increase by using the powerpc fls() implementation. Signed-off-by: Jeremy Kerr <jk@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); }
В списке pgsql-hackers по дате отправления: