Git Product home page Git Product logo

Comments (5)

lemire avatar lemire commented on September 13, 2024

Can't you use roaring_uint32_iterator_previous?

from croaring.

xin-hedera avatar xin-hedera commented on September 13, 2024

Can't you use roaring_uint32_iterator_previous?

I don’t think it can perform well given there are a large number of bits between the end of the range to search and the last value in the roaring bitmap. My assumption is by using that function, the implementation needs to iterates backwards from the last value.

from croaring.

Dr-Emann avatar Dr-Emann commented on September 13, 2024

I'd recommend making a benchmark showing an unreasonable performance loss.

Keep in mind that Roaring bitmaps are compressed bitmaps, going back to the previous set bit will never have to do much work. For instance, in:

roaring_bitmap_t *r = roaring_bitmap_from(1, UINT32_MAX);
roaring_uint32_iterator_t it;
roaring_iterator_init(r, &it);
roaring_uint32_iterator_move_equalorlarger(&it, 2); // Iterator points at UINT32_MAX
roaring_uint32_iterator_previous(&it);              // Iterator points at 1

both roaring_uint32_iterator_move_equalorlarger and roaring_uint32_iterator_previous will be very quick, as the iterator is able to skip directly between the two values.

from croaring.

lemire avatar lemire commented on September 13, 2024

This being said, if you want to implement the desired functionality, a pull request would be given full consideration. It could lead to more elegant code.

from croaring.

xin-hedera avatar xin-hedera commented on September 13, 2024

Thank you all. The proposed flow of euqlorlarger then going back to find the value should perform well. I'm closing the issue as a result.

from croaring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.