Created
August 22, 2014 18:02
-
-
Save rubensayshi/1f9103b952d79b4c0646 to your computer and use it in GitHub Desktop.
redis is amazing <3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 100mil 'entities' | |
# need to be able to check from a random subset if 'something' is TRUE or FALSE | |
# set booleans in a redis bitmap where the ID for the entities are the offset | |
$ redis-cli | |
> SETBIT mybitmap 100000000 1 # 8ms | |
> SETBIT mybitmap 99999999 1 # 2ms | |
> SETBIT mybitmap 10000000 1 # 2ms, etc | |
> SETBIT mybitmap 1000000 1 | |
> SETBIT mybitmap 100000 1 | |
> SETBIT mybitmap 10000 1 | |
> SETBIT mybitmap 1000 1 | |
> SETBIT mybitmap 100 1 | |
> SETBIT mybitmap 10 1 | |
> SETBIT mybitmap 1 1 | |
# memory used for this bitmap 16MB | |
> GETBIT mybitmap 99999999 # 2ms | |
> GETBIT mybitmap 99988889 # 2ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment