Skip to content

Optimize Extend / insert many #48

@pczarn

Description

@pczarn

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);
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions