roaring icon indicating copy to clipboard operation
roaring copied to clipboard

Does there exist an efficient approach to convert between 64bit roaring and 32bit roaring?

Open yingfeng opened this issue 5 years ago • 7 comments

We've met a situation that the conversion between 64bit roaring and 32bit roaring needs to be computed very fast. Currently, we can only use a naive solution that during iterating one bitmap while inserting into the other at the same time, which is pretty time consuming given a high bitmap cardinality. Is it possible to provide an efficient approach such that the conversion could be performed internally without decompression and compression one by one?

yingfeng avatar May 28 '20 03:05 yingfeng

I do not understand this issue. Can you provide a sample Go code that you are using?

lemire avatar May 28 '20 15:05 lemire

//m is an instance of 64bit roaring bitmap
//mp is an instance of 32bit roaring bitmap

is := m.Slice()
{
  vs := make([]uint32, len(is), len(is))
   for j, v := range is {
      vs[j] = uint32(v)
   }
   mp.AddMany(vs)
  }

This code snippet is used to extract ids from source roaring bitmap(eg 64bit roaring), and then insert to target roaring bitmap after the type conversion (eg 32bit roaring).

The overhead is pretty high, any suggestions to make this precedure accelerated?

yingfeng avatar May 29 '20 01:05 yingfeng

What is a 64-bit roaring bitmap? There is no such thing in the library right now.

lemire avatar May 29 '20 12:05 lemire

Oh, sorry, I use the pilosa fork of the go roaring which provides the 64bit bitmap ...

yingfeng avatar May 29 '20 13:05 yingfeng

Right. So the question is how to go from Pilosa to the roaring implementation in this repo, here, is that correct?

lemire avatar May 29 '20 14:05 lemire

Using the WIP 64bit solution of this repo, could the conversion between 32bit and 64bit roaring have a faster approach?

yingfeng avatar May 29 '20 14:05 yingfeng

Yeah... but the WIP is a WIP. We need help with it to make sure it meets people’s needs. Could you help?

lemire avatar May 29 '20 21:05 lemire