Skip to content

FrozenBitmap

Compare
Choose a tag to compare
@Ezibenroc Ezibenroc released this 02 Jun 15:06
· 206 commits to master since this release
0.2.0
f23883b

FrozenBitMap

The major addition of this release is the new class FrozenBitMap. It is analogous to the frozenset of the standard library: a FrozenBitMap is an immutable object that can be hashed.
The main usecase is to use them in sets or dictionnaries:

from pyroaring import FrozenBitMap
mydict = {FrozenBitMap() : 'an empty bitmap',
          FrozenBitMap([1, 3, 5, 7, 9]) : 'some odd numbers',
          FrozenBitMap([1, 2, 4, 8, 16]) : 'powers of two'
}

Optimizations

Several performance optimizations have been implemented :

  • Getting a small slice from a large bitmap used to be very long. This is now fixed.
  • Two methods run_optimize() and shrink_to_fit() have been added. They call their CRoaring counterpart.

Information

The version number and the git hash of both pyroaring and CRoaring are available from the module:

import pyroaring
print(pyroaring.__version__)
print(pyroaring.__git_version__)
print(pyroaring.__croaring_version__)
print(pyroaring.__croaring_git_version__)