]> git.saurik.com Git - redis.git/commit - src/bitops.c
BITCOUNT performance improved.
authorantirez <antirez@gmail.com>
Sun, 20 May 2012 19:34:58 +0000 (21:34 +0200)
committerantirez <antirez@gmail.com>
Thu, 24 May 2012 13:25:06 +0000 (15:25 +0200)
commitc19bfe9fcfdf6dac998f31463df31504c3bacb2b
treef3260e130636b5cfe5d380cdab3eb05e5ee10af9
parente53a1fdd603370b3ac0cf3644253cfce5fac6740
BITCOUNT performance improved.

At Redis's default optimization level the command is now much faster,
always using a constant-time bit manipualtion technique to count bits
instead of GCC builtin popcount, and unrolling the loop.

The current implementation performance is 1.5GB/s in a MBA 11" (1.8 Ghz
i7) compiled with both GCC and clang.

The algorithm used is described here:

http://graphics.stanford.edu/~seander/bithacks.html
src/bitops.c