From: | "Steinar H(dot) Gunderson" <sgunderson(at)bigfoot(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: [GENERAL] Creation of tsearch2 index is very slow |
Date: | 2006-01-20 21:44:02 |
Message-ID: | 20060120214402.GA22493@uio.no |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-performance |
On Fri, Jan 20, 2006 at 10:37:54PM +0100, Martijn van Oosterhout wrote:
> Given that all it's doing is counting bits, a simple fix would be to
> loop over bytes, use XOR and count ones. For extreme speedup create a
> lookup table with 256 entries to give you the answer straight away...
For extra obfscation:
unsigned v = (unsigned)c;
int num_bits = (v * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f;
(More more-or-less intelligent options at
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive :-) )
/* Steinar */
--
Homepage: http://www.sesse.net/
From | Date | Subject | |
---|---|---|---|
Next Message | Rick Gigger | 2006-01-20 21:48:28 | panic on 7.3 |
Previous Message | Martijn van Oosterhout | 2006-01-20 21:37:54 | Re: [GENERAL] Creation of tsearch2 index is very slow |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-01-20 21:50:17 | Re: [GENERAL] Creation of tsearch2 index is very slow |
Previous Message | Jerry Sievers | 2006-01-20 21:42:20 | Sudden slowdown of Pg server |