]> 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:20:11 +0000 (15:20 +0200)
commit7c34643f154f543e1eef7c9855fb8d657146c646
tree9f543a1846969412b69481a58c360d36da3ee1e1
parent80f8028e3c0d9948c3f1e1eb56cda1dbbf891d02
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