Project

roaring

0.0
No release in over a year
Roaring bitmaps for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

Roaring

A Ruby wrapper for CRoaring (a C/C++ implementation at https://github.com/RoaringBitmap/CRoaring)

Roaring Bitmaps are a compressed bitmap/bitset format/library. More information and papers can be found at https://roaringbitmap.org/

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add roaring

Usage

require "roaring"

# Bitmaps can efficiently store a large range of 32-bit integers
bitmap = Roaring::Bitmap[1, 2, 3, 999]
bitmap << (2**32 - 1)

# Element access
bitmap.each { }
bitmap.first # => 1
bitmap.min   # => 1
bitmap.max   # => 4294967295
bitmap.last  # => 4294967295
bitmap[3]    # => 999

b1 = Roaring::Bitmap.new(200...500)
b2 = Roaring::Bitmap.new(100...1000)

# Support common set operations
(b1 & b2).size # => 300
(b1 ^ b2).size # => 600
(b2 - b1).size # => 600
(b1 - b2).empty? # => true
b1 < b2 # => true
(b2 - b1) == (b1 ^ b2) # => true

# (De)Serialization (also available via Marshal#{dump,load})
dump = bitmap.serialize
loaded = Roaring::Bitmap.deserialize(dump)
loaded == bitmap # => true

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jhawthorn/roaring. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the Apache License, Version 2.0.

Code of Conduct

Everyone interacting in the Roaring project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.