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

Speed up bitmapSearch #1

Open
DictumMortuum opened this issue May 30, 2016 · 0 comments
Open

Speed up bitmapSearch #1

DictumMortuum opened this issue May 30, 2016 · 0 comments

Comments

@DictumMortuum
Copy link
Owner

DictumMortuum commented May 30, 2016

Do didn't ask about performance, but you can speed up bitmapSearch for sparse bitmaps by first looking at a byte at a time. If looking for a 1, you can skip bytes that are 0x00, and if looking for a 0, you can skip bytes that are 0xFF. After that, you can scan the bits on the next byte or use a look-up table on it.

I'd also have bitmapSearch take its size as a bit count instead of a byte count. Then if the client only cares about, say, 26 bits for letters, they don't have to worry about a search returning 27 because the bitmap really have 32 bits in it.

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

1 participant