Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preallocate bloom? #5

Open
jdunck opened this issue Nov 6, 2012 · 3 comments
Open

Preallocate bloom? #5

jdunck opened this issue Nov 6, 2012 · 3 comments

Comments

@jdunck
Copy link

jdunck commented Nov 6, 2012

Redis doesn't alloc the string memory until it needs to, whcih means setbit isn't a predictably O(1) operation.

What do you think of doing "setbit key 0" in init_pyrebloom? (iff the key doesn't already exist)

That would be a pretty quick and rare op and then provide o(1) for all later setbits.

@jdunck
Copy link
Author

jdunck commented Nov 6, 2012

(referring to the warning here:)
http://redis.io/commands/setbit

@dlecocq
Copy link

dlecocq commented Nov 6, 2012

Do you mean setbit key <number of bits>? So that it never has to reallocate?

@jdunck
Copy link
Author

jdunck commented Nov 7, 2012

Yep, I think github formatting ate my attempt at comment, but yeah, the idea would be to set the furthest bit upon creation so that all later sets wouldn't need to allocate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants