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

Use trailing zeros in bitmap to_array conversion #68

Merged
merged 2 commits into from
Nov 1, 2020

Conversation

damnMeddlingKid
Copy link
Contributor

@damnMeddlingKid damnMeddlingKid commented Oct 21, 2020

This PR implements an optimization on bitmap to_array conversion by utilizing the trailing_zeros method.

Curious if theres a good reason to not implement it this way. Im still learning rust so let me know if this looks off.

this version is faster when there are gaps between set bits and performs about the same when all 64 bits are set.
cc: @Nemo157

@Kerollmops
Copy link
Member

Hey @damnMeddlingKid,

I am the new maintainer of this repository and wanted to make sure that merging or testing this PR works correctly, I just updated the CI and the bors settings, so could it be possible that you rebase on master please? (don't forget to pull master before rebasing 😄)

@Kerollmops
Copy link
Member

Kerollmops commented Oct 29, 2020

Hey @josephglanville,

Do you have time to make sure that this is a valid change? I am not sure that only the tests can be trusted.

Thank you :)

@josephglanville
Copy link
Contributor

Sure, I will take a look.

@damnMeddlingKid
Copy link
Contributor Author

im getting

 ! [remote rejected] optimized-to-array -> optimized-to-array (refusing to allow an OAuth App to create or update workflow `.github/workflows/test.yml` without `workflow` scope)

after rebasing, is that related to the CI changes ?.

@Kerollmops
Copy link
Member

Ho this is maybe related to the fact that the remote URL changed, not sure!

@lemire
Copy link
Member

lemire commented Oct 29, 2020

@damnMeddlingKid It might help to update your remote to the new repository. Note that the repository's location changed. It should not be necessary... but...

@damnMeddlingKid
Copy link
Contributor Author

actually i have the upstream setup to this repository already.

this is what i have setup

git remote -v
origin	https://github.com/damnMeddlingKid/roaring-rs.git (fetch)
origin	https://github.com/damnMeddlingKid/roaring-rs.git (push)
upstream	https://github.com/RoaringBitmap/roaring-rs.git (fetch)
upstream	https://github.com/RoaringBitmap/roaring-rs.git (push)

here are the steps that i ran

git checkout master
git fetch upstream master
git merge upstream/master

git checkout optimized-to-array
git rebase master
git push -f origin optimized-to-array

this throws the following error

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/damnMeddlingKid/roaring-rs.git
 ! [remote rejected] franklyn-test-branch -> franklyn-test-branch (refusing to allow an OAuth App to create or update workflow `.github/workflows/test.yml` without `workflow` scope)
error: failed to push some refs to 'https://github.com/damnMeddlingKid/roaring-rs.git'

@Kerollmops
Copy link
Member

Kerollmops commented Oct 29, 2020

@damnMeddlingKid Have you found this link already? https://techdailychronicle.com/github-actions-error-refusing-to-allow-an-oauth-app-to-create-or-update-workflow/

To fix this I regenerated a Personal Access Token from within GitHub and then went into Credential Manager within Windows and reset the password to the new personal access token and bingo – I can now push the code once more.

And if you don't find how to fix it, maybe it would be easier to create a new PR with your two commits?

@damnMeddlingKid
Copy link
Contributor Author

thanks, that sort of helped. i realized i wasn't using the ssh paths in my remotes.

@Kerollmops
Copy link
Member

I am waiting for a review from @josephglanville before merging.

bors try

bors bot added a commit that referenced this pull request Oct 29, 2020
@bors
Copy link
Contributor

bors bot commented Oct 29, 2020

try

Build succeeded:

@josephglanville
Copy link
Contributor

Both behaviour and performance are identical as far as I can tell. This code is perhaps slightly more readable.
bors r+

@bors
Copy link
Contributor

bors bot commented Nov 1, 2020

🔒 Permission denied

Existing reviewers: click here to make josephglanville a reviewer

bors bot added a commit that referenced this pull request Nov 1, 2020
74: Add remove_range benchmark that triggers bitmap to array conversion r=Kerollmops a=josephglanville

Wrote this to verify assumptions of #68 there are other benches that trigger bitmap to array conversion but this nicely isolates it.

Co-authored-by: Joseph Glanville <jpg@jpg.id.au>
@Kerollmops
Copy link
Member

Thank you @josephglanville, I will merge your benchmarks in #74 before this one.
bors r+

@bors
Copy link
Contributor

bors bot commented Nov 1, 2020

Build succeeded:

@bors bors bot merged commit 1b0bedb into RoaringBitmap:master Nov 1, 2020
@Kerollmops
Copy link
Member

Thank you @damnMeddlingKid for your pull request, it indeed make the code simpler! 👍

@damnMeddlingKid
Copy link
Contributor Author

Both behaviour and performance are identical as far as I can tell. This code is perhaps slightly more readable.

The existing performance benchmark sets ranges in the bitmap so the performance doesn't benefit much from this optimization. I expect it would make a difference on real world data.

Thanks for the review !

@damnMeddlingKid damnMeddlingKid deleted the optimized-to-array branch November 1, 2020 21:02
not-jan pushed a commit to not-jan/roaring-rs that referenced this pull request Aug 31, 2022
74: Add remove_range benchmark that triggers bitmap to array conversion r=Kerollmops a=josephglanville

Wrote this to verify assumptions of RoaringBitmap#68 there are other benches that trigger bitmap to array conversion but this nicely isolates it.

Co-authored-by: Joseph Glanville <jpg@jpg.id.au>
not-jan pushed a commit to not-jan/roaring-rs that referenced this pull request Aug 31, 2022
68: Use trailing zeros in bitmap to_array conversion r=Kerollmops a=damnMeddlingKid

This PR implements an optimization on bitmap to_array conversion by utilizing the trailing_zeros method. 

Curious if theres a good reason to not implement it this way. Im still learning rust so let me know if this looks off.

this version is faster when there are gaps between set bits and performs about the same when all 64 bits are set.
cc: @Nemo157 

Co-authored-by: Franklyn D'souza <franklynd@gmail.com>
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

Successfully merging this pull request may close these issues.

4 participants