HyperLogLog approximated cardinality caching.
HyperLogLog approximated cardinality caching.

The more we add elements to an HyperLogLog counter, the smaller is
the probability that we actually update some register.

From this observation it is easy to see how it is possible to use
caching of a previously computed cardinality and reuse it to serve
HLLCOUNT queries as long as no register was updated in the data
structure.

This commit does exactly this by using just additional 8 bytes for the
data structure to store a 64 bit unsigned integer value cached
cardinality. When the most significant bit of the 64 bit integer is set,
it means that the value computed is no longer usable since at least a
single register was modified and we need to recompute it at the next
call of HLLCOUNT.

The value is always stored in little endian format regardless of the
actual CPU endianess.

linfangrong/redis,universsky/redis,StevenTsai/redis,ytjiang/redis,blackmady/redis,blackmady/redis,mcanthony/redis,simplestbest/redis,francischan714/redis,csuhawk/redis,guker/redis,cloudrain21/redis,ctripcorp/redis,ytjiang/redis,vincent-vivian-liu/redis,CodeJuan/redis,itamarhaber/redis,ErikDubbelboer/redis,soveran/redis,kensou97/redis,taoguan/redis,gilala/hredis,soloestoy/redis,rogerlz/redis,clamoriniere1A/redis,mengyou0304/redis,jbochi/parallel_redis,july2993/redis,yuhc/redis-benchmark-enhanced,clamoriniere1A/redis,ton31337/redis,fengshao0907/redis,supasate/redis,mverrilli/redis,zczhuohuo/redis,weizijun/redis,qiyang0221/redis,jasonkying/redis,netroby/redis,itugs/redis,weizijun/redis,rogerchina/redis,mattsta/redis,citusdata/redis,kensou97/redis,zguangyu/redis,4396/redis,rogerlz/redis,Markgorden/redis,YuraLukashik/redis,zhcy/redis,kaushik94/redis,190235047/redis,NBSW/redis,cloudrain21/redis,josiahcarlson/redis,soveran/redis,wbailey5/redis,seppo0010/rlite-server,Sciumo/redis,wujf/redis,valdsJohn/redis,takeshineshiro/redis,LongXQ/redis,healerkx/redis,harrisonfeng/redis,dreamquster/redis,j0hnma/hszredis,programmecat/redis,roth1002/redis,mengzhejin/RedisStudy,ctripcorp/redis,janekmi/redis,nuxeh/redis,elkingtonmcb/redis,YuraLukashik/redis,wujf/redis,MasahikoSawada/redis,ton31337/redis,roth1002/redis,rouzier/redis,pcarrier/redis,hgl888/redis,pmem/redis,programmecat/redis,seandsky/redis,LongXQ/redis,july2993/redis,pkdevbox/redis,MasahikoSawada/redis,riyan8250/redis,mingyaaaa/redis,YuanZhewei/redis,Wangyao14cyy/redis,GrimDerp/redis,supasate/redis,shining-yang/redis,mumingv/redis,mengyou0304/redis,saisai/redis,sunheehnus/redis,soloestoy/redis,qiyang0221/redis,cusspvz/redis,seppo0010/rlite-server,jingjidejuren/redis,4396/redis,ituncle/redis,mgk/redis,mcanthony/redis,linfangrong/redis,timothyohare/3rdPartySrc-redis,AplayER/redis,ton31337/redis,gaoxianglong/redis,kmiku7/redis,abhiklodh/redis,Soledad89/redis,narma/redis,duanx/redis,RepmujNetsik/redis,tjschuck/redis,aim-for-better/redis,rouzier/redis,wujf/redis,jasonkying/redis,mcanthony/redis,citusdata/redis,universsky/redis,modulexcite/redis,soloestoy/redis,abhiklodh/redis,kmiku7/redis,mattsta/redis,h0x91b/redis,shreesundara/redis,soveran/redis,zhiliaoniu/redis,hedisdb/hedis,huyuezheng/redis,gilala/redis,abhiklodh/redis,AALEKH/redis,YuanZhewei/redis,kmiku7/redis,AALEKH/redis,a-pavlov/redis,neomantra/redis,jackyan/redis,healerkx/redis,taoguan/redis,jingjidejuren/redis,saisai/redis,cusspvz/redis,huyuezheng/redis,h0x91b/redis,PKRoma/redis,4396/redis,ytjiang/redis,izhoujie/redis,izhoujie/redis,yossigo/redis,arijitvt/redis,clamoriniere1A/redis,brg-liuwei/redis,j0hnma/hszredis,190235047/redis,wprice/redis,duanx/redis,rogerchina/redis,OmarQunsul/graph-redis,dreamquster/redis,weizijun/redis,MOON-CLJ/redis,atreeyang/redis,hgl888/redis,h0x91b/redis,nnog/redis,RepmujNetsik/redis,GrimDerp/redis,guker/redis,SummonY/redis,simplestbest/redis,dayuoba/redis,soveran/redis,AALEKH/redis,devaos/redis,blackmady/redis,SyntaxStacks/redis,antirez/redis,gilala/hredis,narma/redis,jbochi/parallel_redis,ncopa/redis,dayuoba/redis,hedisdb/hedis,AplayER/redis,cnbin/redis,charsyam/redis,badboy/redis,wprice/redis,gilala/hredis,iandyh/redis,JoeWoo/redis,atreeyang/redis,mattsta/redis,wangyikai/redis,pcarrier/redis,jackyan/redis,jingjidejuren/redis,twskipper/redis,yossigo/redis,YongMan/redis,kensou97/redis,netroby/redis,gilala/hbjredis,ipmobiletech/redis,pcarrier/redis,dayuoba/redis,ofirluzon/redis,shreesundara/redis,seandsky/redis,alenslan/redis,Wangyao14cyy/redis,gaoxianglong/redis,dreamquster/redis,valdsJohn/redis,PradheepShrinivasan/redis,aim-for-better/redis,rogerlz/redis,pedigree/redis,mengzhejin/RedisStudy,davidradunz/redis,Aaron1992/redis,shining-yang/redis,harrisonfeng/redis,hornen/redis,xuguruogu/redis,ipmobiletech/redis,allengaller/redis,xujunhai1991/redis,Sciumo/redis,yuhc/redis-benchmark-enhanced,dreamquster/redis,wenxueliu/redis_comment,honestme/redis,charsyam/redis,rouzier/redis,ofirluzon/redis,supasate/redis,rogerchina/redis,cloudrain21/redis,RepmujNetsik/redis,a-pavlov/redis,xujunhai1991/redis,ofirluzon/redis,ctripcorp/redis,spinlock/redis,holstvoogd/redis,ton31337/redis,tellapart/redis,Sciumo/redis,j0hnma/szredis,pedigree/redis,gilala/bjredis,hawkchch/redis,pcarrier/redis,ErikDubbelboer/redis,saisai/redis,pmem/redis,atreeyang/redis,cusspvz/redis,gilala/bjredis,roth1002/redis,AplayER/redis,GrimDerp/redis,Wangyao14cyy/redis,neomantra/redis,charsyam/redis,Aaron1992/redis,ErikDubbelboer/redis,nnog/redis,yossigo/redis,GitHubMota/redis,modulexcite/redis,twskipper/redis,riyan8250/redis,gaoxianglong/redis,thomasdarimont/redis,holstvoogd/redis,kaushik94/redis,fengshao0907/redis,simplestbest/redis,OmarQunsul/graph-redis,honestme/redis,Aliceljm1/redis,hedisdb/hedis,Aaron1992/redis,holstvoogd/redis,mgk/redis,pedigree/redis,holstvoogd/redis,SyntaxStacks/redis,Wangyao14cyy/redis,JoeWoo/redis,HeartSaVioR/redis,nuxeh/redis,izhoujie/redis,xuguruogu/redis,ouyangkongtong/redis,OmarQunsul/graph-redis,brg-liuwei/redis,neomantra/redis,kaushik94/redis,linfangrong/redis,tanghaodong25/redis,spinlock/redis,devaos/redis,seppo0010/rlite-server,elkingtonmcb/redis,seppo0010/redis,colstrom/redis,pmem/redis,hedisdb/hedis,itugs/redis,josiahcarlson/redis,brg-liuwei/redis,ErikDubbelboer/redis,iandyh/redis,gilala/hbjredis,narma/redis,tjschuck/redis,iandyh/redis,jasonkying/redis,badboy/redis,francischan714/redis,saisai/redis,Soledad89/redis,janekmi/redis,PKRoma/redis,a-pavlov/redis,twskipper/redis,YuraLukashik/redis,pkdevbox/redis,190235047/redis,Aliceljm1/redis,colstrom/redis,190235047/redis,hornen/redis,RepmujNetsik/redis,pkdevbox/redis,itugs/redis,Markgorden/redis,StevenTsai/redis,xlzhan/redis,j0hnma/hszredis,colstrom/redis,devaos/redis,sunheehnus/redis,xujunhai1991/redis,soloestoy/redis,badboy/redis,mingyaaaa/redis,mverrilli/redis,aim-for-better/redis,ncopa/redis,mgk/redis,YongMan/redis,zczhuohuo/redis,harrisonfeng/redis,pmem/redis,takeshineshiro/redis,izhoujie/redis,gilala/hbjredis,shining-yang/redis,nuxeh/redis,takeshineshiro/redis,zguangyu/redis,vincent-vivian-liu/redis,pedigree/redis,zhcy/redis,alenslan/redis,ncopa/redis,jbochi/redis,mengyou0304/redis,csuhawk/redis,universsky/redis,ouyangkongtong/redis,programmecat/redis,PKRoma/redis,pkdevbox/redis,gilala/bjredis,zhcy/redis,wenxueliu/redis_comment,wprice/redis,timothyohare/3rdPartySrc-redis,guker/redis,cnbin/redis,gaoxianglong/redis,YongMan/redis,JoeWoo/redis,mingyaaaa/redis,flashbuckets/redis,gilala/redis,citusdata/redis,citusdata/redis,zguangyu/redis,yossigo/redis,tellapart/redis,harrisonfeng/redis,rogerchina/redis,zhiliaoniu/redis,mengyou0304/redis,Markgorden/redis,valdsJohn/redis,zczhuohuo/redis,oranagra/redis,ytjiang/redis,fengshao0907/redis,xuguruogu/redis,jbochi/redis,j0hnma/szredis,tjschuck/redis,NBSW/redis,tjschuck/redis,wprice/redis,qiyang0221/redis,a-pavlov/redis,seppo0010/redis,PKRoma/redis,hgl888/redis,netroby/redis,huyuezheng/redis,flashbuckets/redis,gilala/hredis,sunheehnus/redis,vincent-vivian-liu/redis,nnog/redis,HeartSaVioR/redis,duanx/redis,ituncle/redis,cnbin/redis,YuanZhewei/redis,SummonY/redis,netroby/redis,StevenTsai/redis,linfangrong/redis,clamoriniere1A/redis,GitHubMota/redis,wujf/redis,CodeJuan/redis,csuhawk/redis,simplestbest/redis,colstrom/redis,gilala/redis,weizijun/redis,healerkx/redis,hgl888/redis,aim-for-better/redis,wangyikai/redis,MasahikoSawada/redis,timothyohare/3rdPartySrc-redis,allengaller/redis,seppo0010/redis,ituncle/redis,GrimDerp/redis,YongMan/redis,seandsky/redis,wenxueliu/redis_comment,janekmi/redis,jackyan/redis,modulexcite/redis,devaos/redis,itamarhaber/redis,huyuezheng/redis,hawkchch/redis,hornen/redis,antirez/redis,nnog/redis,rogerlz/redis,dayuoba/redis,yuhc/redis-benchmark-enhanced,CodeJuan/redis,gilala/bjredis,valdsJohn/redis,thomasdarimont/redis,kaushik94/redis,davidradunz/redis,j0hnma/szredis,blackmady/redis,Aaron1992/redis,rouzier/redis,MOON-CLJ/redis,YuraLukashik/redis,ouyangkongtong/redis,mumingv/redis,itamarhaber/redis,badboy/redis,wbailey5/redis,xlzhan/redis,j0hnma/hszredis,davidradunz/redis,healerkx/redis,mengzhejin/RedisStudy,AALEKH/redis,PKRoma/redis,z-fork/redis,4396/redis,takeshineshiro/redis,july2993/redis,tanghaodong25/redis,jackyan/redis,Soledad89/redis,alenslan/redis,LongXQ/redis,ofirluzon/redis,xuguruogu/redis,StevenTsai/redis,yuhc/redis-benchmark-enhanced,mumingv/redis,janekmi/redis,jingjidejuren/redis,OmarQunsul/graph-redis,charsyam/redis,h0x91b/redis,ipmobiletech/redis,itamarhaber/redis,elkingtonmcb/redis,taoguan/redis,tellapart/redis,thomasdarimont/redis,GitHubMota/redis,PradheepShrinivasan/redis,mverrilli/redis,shreesundara/redis,tanghaodong25/redis,MasahikoSawada/redis,hawkchch/redis,oranagra/redis,gilala/redis,z-fork/redis,shining-yang/redis,jbochi/redis,francischan714/redis,duanx/redis,arijitvt/redis,Aliceljm1/redis,flashbuckets/redis,itugs/redis,cloudrain21/redis,josiahcarlson/redis,yossigo/redis,honestme/redis,ncopa/redis,wenxueliu/redis_comment,wbailey5/redis,JoeWoo/redis,csuhawk/redis,mverrilli/redis,seandsky/redis,spinlock/redis,zhiliaoniu/redis,abhiklodh/redis,MOON-CLJ/redis,antirez/redis,riyan8250/redis,atreeyang/redis,Sciumo/redis,SyntaxStacks/redis,josiahcarlson/redis,wbailey5/redis,mgk/redis,tellapart/redis,elkingtonmcb/redis,hawkchch/redis,guker/redis,tanghaodong25/redis,riyan8250/redis,antirez/redis,roth1002/redis,zhiliaoniu/redis,oranagra/redis,j0hnma/szredis,PradheepShrinivasan/redis,vincent-vivian-liu/redis,allengaller/redis,oranagra/redis,neomantra/redis,spinlock/redis,seppo0010/rlite-server,neomantra/redis,z-fork/redis,mengzhejin/RedisStudy,GitHubMota/redis,HeartSaVioR/redis,PradheepShrinivasan/redis,CodeJuan/redis,SyntaxStacks/redis,ofirluzon/redis,zhcy/redis,HeartSaVioR/redis,xlzhan/redis,supasate/redis,allengaller/redis,zguangyu/redis,kensou97/redis,jasonkying/redis,fengshao0907/redis,z-fork/redis,alenslan/redis,nuxeh/redis,oranagra/redis,wangyikai/redis,timothyohare/3rdPartySrc-redis,kmiku7/redis,seppo0010/redis,Markgorden/redis,AplayER/redis,YuanZhewei/redis,mumingv/redis,charsyam/redis,cusspvz/redis,shreesundara/redis,cnbin/redis,ipmobiletech/redis,NBSW/redis,programmecat/redis,mcanthony/redis,wangyikai/redis,jbochi/parallel_redis,arijitvt/redis,flashbuckets/redis,hornen/redis,davidradunz/redis,xlzhan/redis,universsky/redis,NBSW/redis,SummonY/redis,mingyaaaa/redis,sunheehnus/redis,zczhuohuo/redis,gilala/hbjredis,arijitvt/redis,thomasdarimont/redis,Soledad89/redis,brg-liuwei/redis,LongXQ/redis,ouyangkongtong/redis,twskipper/redis,Aliceljm1/redis,taoguan/redis,SummonY/redis,iandyh/redis,modulexcite/redis,soloestoy/redis,honestme/redis,july2993/redis,xujunhai1991/redis,qiyang0221/redis,francischan714/redis,ituncle/redis,ctripcorp/redis