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

Add remove_front and remove_back method #253

Merged
merged 55 commits into from
Jul 17, 2023

Conversation

shimatar0
Copy link
Contributor

@shimatar0 shimatar0 commented May 12, 2023

What does this PR do?

  • added remove the first n elements method and remove the last n elements method

Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shimatar0 👋, Could you please rebase on main?

Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About both RoaringBitmap::remove_first/last methods implementations. Would it be possible not to check the length before, as I am pretty sure it takes time to compute it? It is O(n) where n is the number of containers.

Can we find better names? I would prefer remove_front and remove_back to match the pop_front/back API of the VecDeque collection. What do you think?

Would it be possible to change the API of those too methods to accept u64 instead of usize? It would be more consistent with the rest of the API and will work correctly on u32 computers.

src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/store/array_store/mod.rs Outdated Show resolved Hide resolved
src/bitmap/store/array_store/mod.rs Show resolved Hide resolved
src/bitmap/store/bitmap_store.rs Outdated Show resolved Hide resolved
src/bitmap/store/bitmap_store.rs Outdated Show resolved Hide resolved
src/bitmap/container.rs Outdated Show resolved Hide resolved
src/bitmap/container.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
src/bitmap/inherent.rs Outdated Show resolved Hide resolved
@Kerollmops
Copy link
Member

Hey @shimatar0 👋,

Could you please apply the suggestions of @Dr-Emann. We will look into rebasing your branch afterward. Unfortunately, the CI doesn't pass. Could you fix it too? Note: That's due to Clippy.

@shimatar0
Copy link
Contributor Author

@Kerollmops

About both RoaringBitmap::remove_first/last methods implementations. Would it be possible not to check the length before, as I am pretty sure it takes time to compute it? It is O(n) where n is the number of containers.

@Dr-Emann's suggestion eliminates the need to know the length in advance:)
6b54277

Can we find better names? I would prefer remove_front and remove_back to match the pop_front/back API of the VecDeque collection. What do you think?

Renamed methods.
f4080d9

Would it be possible to change the API of those too methods to accept u64 instead of usize? It would be more consistent with the rest of the API and will work correctly on u32 computers.

Use u64 instead of `usize.
b7c5b5a

@shimatar0
Copy link
Contributor Author

Hey! @Kerollmops 👋

Thanks for the your review.
Fixed the suggestion so that there is no clippy warning.

Could you please apply the suggestions of @Dr-Emann. We will look into rebasing your branch afterward. Unfortunately, the CI doesn't pass. Could you fix it too? Note: That's due to Clippy.

@Kerollmops Kerollmops changed the title Add remove_first and remove_last method Add remove_front and remove_back method Jul 14, 2023
@Kerollmops
Copy link
Member

Kerollmops commented Jul 15, 2023

Hey @Dr-Emann 👋

I wanted to thank you very much for this particularly good code review of yours! Always impressed by what you spot ☺️

Have a nice weekend ☀️

@Kerollmops Kerollmops merged commit 9f69285 into RoaringBitmap:main Jul 17, 2023
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.

3 participants