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

Optimize Extend / insert many #48

Open
pczarn opened this issue Jul 16, 2024 · 0 comments
Open

Optimize Extend / insert many #48

pczarn opened this issue Jul 16, 2024 · 0 comments

Comments

@pczarn
Copy link
Contributor

pczarn commented Jul 16, 2024

We really should specialize for extend with iterators that can be cloned. Possibly as an additional fn.

Let's check the speed of Extend w.r.t. growing.

Best to get a maximum of all elements, then grow once if needed.

impl<B: BitBlock> Extend<usize> for BitSet<B> {
    #[inline]
    fn extend<I: IntoIterator<Item = usize>>(&mut self, iter: I) {
        for i in iter {
            self.insert(i);
        }
    }
}
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