Skip to content

Feature request: intersection, union, and difference with the tail of another bitmap #591

@tudor

Description

@tudor

I have two bitmaps a and b, I find one point inside b (say using an iterator), and then I want to intersect / union / compute the set difference of a with the tail of b after that point.

That is, I'd like the equivalent of

b.removeRange(0, x);
a &= b;

without the overhead of mutating b (the memmove from array containers shows up meaningfully in my CPU profile).

Roaring iterators already have all the information needed to implement this efficiently, and I sometimes need to walk through a to find the right spot (it's not as easy as rank(x)) so I'd prefer this:

auto it = b.begin();
it.move(x);
a.intersectTail(it);
// intersectRange(it, b.end()) would be nice too, but that means you have to be able to 
// deal with partial containers at both ends instead of just at the beginning so it's a bit
// harder to implement

Do you think this is worth implementing?

Thanks,
-Tudor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions