Swift wrapper for CRoaring (a C/C++ implementation at https://github.com/RoaringBitmap/CRoaring)
Roaring bitmaps are used by several important systems:
Roaring bitmaps are found to work well in many important applications:
Use Roaring for bitmap compression whenever possible. Do not use other bitmap compression methods (Wang et al., SIGMOD 2017)
Swift 4.0 or higher
Create a directory where you will create your application:
mkdir foo
cd foo
swift package init --type executable
Then edit Package.swift
so that it reads something like this:
import PackageDescription
let package = Package(
name: "foo",
dependencies: [
.package(url: "https://github.com/RoaringBitmap/SwiftRoaring", from: "0.0.1")
],
targets: [
.target(
name: "foo",
dependencies: ["SwiftRoaring"]),
]
)
Edit main.swift
(in Sources) so that it looks something like this :
import SwiftRoaring;
....
Here is a simplified but complete example:
import SwiftRoaring
//Create a new Roaring Bitmap
let bitmap = RoaringBitmap()
//Example: Add Range
bitmap.addRange(min: 0, max: 500)
//Example: copy
let cpy = bitmap.copy()
//Example: Operators
let and = bitmap && cpy
//Example: Iterate
for i in bitmap {
print(i)
}
//See documentation for more functionalities!
You can build using Swift Package Manager as follows:
swift build --configuration release
To find where the library is built, type the following in your shell:
echo $(swift build --configuration release --show-bin-path)
You can run tests using Swift Package Manager as follows:
swift test
$ swift build --configuration release
$ swift repl -I .build/release -L .build/release -lSwiftRoaringDynamic
1> import SwiftRoaring
2> let bitmap = RoaringBitmap()
3> bitmap.add(1)
4> for i in bitmap {
print(i)
}
https://groups.google.com/forum/#!forum/roaring-bitmaps
You can read bitmaps in Go, Java, C, C++ that have been serialized in Java, C, C++.
link |
Stars: 52 |
Last commit: Yesterday |
Syncing with CRoaring 0.9.9
Full Changelog: https://github.com/RoaringBitmap/SwiftRoaring/compare/v2.5.2...v2.5.3
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics