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

Refactor get_next_set #3

Open
tomarrell opened this issue Jul 16, 2018 · 0 comments
Open

Refactor get_next_set #3

tomarrell opened this issue Jul 16, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@tomarrell
Copy link
Owner

"get_next_set's implementation is probably suboptimal.

You loop over the bitset until you reach a bit set to one. Granted the density of this bitset is high as per your choice of number of bits. Still it is difficult to predict, so that a lot of branch prediction error.

Instead you can use u64::trailing_zeros which compiles to a single instructions : https://github.com/tantivy-search/tantivy/blob/78673172d001a0c4c7c73cdd3d9923fc43fc0312/src/common/bitset.rs#L87" - fulmicoton

@tomarrell tomarrell added the enhancement New feature or request label Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant