Library / SDK
RoaringBitmap/CRoaring avatar
RoaringBitmap/CRoaring

CRoaring: SIMD-Optimized Roaring Bitmaps for C and C++

Roaring bitmaps in C (and C++), with SIMD (AVX2, AVX-512 and NEON) optimizations: used by Apache Doris, ClickHouse, Alibaba Tair, Redpanda, YDB and StarRocks

1,899 stars339 forksCNOASSERTION

At a glance

What is it?
CRoaring is a portable C library for compressed bitmap sets, with an optional C++ API and SIMD paths for AVX2, AVX-512 and NEON. It targets systems that need efficient membership, union, intersection and aggregation operations without the memory cost of conventional bitsets.
Who is it for?
CRoaring suits C or C++ services that repeatedly process sparse integer sets and can tolerate a custom-licence review. It is a poor fit for a simple small-set use case or for teams that require a standard OSI-classified licence without checking LICENSE.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • RoaringBitmap/CRoaring1,899 ★ · +0
Star history
Repository2026-10-162026-10-23
RoaringBitmap/CRoaring1.9k1.9k

0 Stars in the last 7 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What CRoaring Solves for Large Integer Sets

CRoaring implements Roaring bitmaps, a compressed representation for sets of integers. A conventional bitset can reserve storage across its full address range even when only a small number of positions are set. CRoaring is intended to reduce that memory burden while retaining efficient bitmap operations.

The target users are systems engineers working in C or C++, especially database, analytics and infrastructure projects that operate on identifiers, document IDs, row selections or other sparse integer domains. The README says CRoaring is used in systems including Apache Doris, ClickHouse, Redpanda, YDB, Alibaba Tair and StarRocks. Those examples establish where the library fits, but they do not establish identical workloads or performance in every deployment.

The project is deliberately low level. It is a library, not a command-line service, query engine or storage system. An application must decide how to create bitmaps, populate them, serialize them and compose set operations. CRoaring provides the bitmap implementation and optional C++ interface, while application code remains responsible for ownership, persistence and integration with its own indexes.

Roaring Representation and Operation Model

The README describes Roaring bitmaps as compressed bitmaps that tend to outperform WAH, EWAH and Concise in important applications. It also links to a serialized format specification, which matters because a bitmap serialized by one implementation can be read and modified through another implementation, provided that the implementation follows that specification.

The project exposes a C API and an optional C++ API. The C API is the central interface for applications that need direct control over bitmap creation and operations. The C++ layer requires a compiler supporting C++11 and is intended for callers that prefer a class-based interface. The repository also contains compressed 64-bit bitmap and conventional bitset examples, so the library is not limited to a single fixed-width use case.

CRoaring's optimization strategy is tied to the host processor. The repository includes SIMD-related paths for AVX2, AVX-512 and NEON. On x64 systems, the README states that runtime dispatch selects optimized functions after detecting CPU features. This avoids requiring every deployment to compile only for one instruction set. ARM and RISC-V use a generic path according to the README, and the project states that generic scalar builds work on additional architectures. That distinction matters when planning binaries for heterogeneous fleets.

Build Paths for CRoaring Integrations

CRoaring documents several consumption paths, but the README does not include the command sequence for Quick Start or the full build flags. The repository contains `CMakeLists.txt`, `cmake/`, `include/`, `src/`, `cpp/`, `amalgamation.sh` and `roaring.pc.in`. Those files make the project suitable for a normal CMake integration and for an amalgamation or unity-style build.

The project lists Linux, macOS, FreeBSD and Windows, including MSYS2 and Visual Studio. It requires a recent C11 compiler: GCC 7 or newer, clang 8 or newer, Xcode 11 or newer, Visual Studio 2022 or newer or Intel oneAPI Compiler 2023.2 or newer. CMake is listed as a requirement for contributors, while users who do not want CMake can rely on amalgamation or unity builds according to the README.

Windows documentation in the README covers Conan and vcpkg usage. The README does not provide the exact package commands, so no invented command is included here. A first integration should begin by choosing one documented route, checking the `LICENSE` file, and then following the corresponding repository instructions for CMake, CMake FetchContent, Conan or vcpkg. The package route also needs version selection, because the listed recent releases include `v5.2.2`, `v5.2.3` and `v5.2.4`.

A First C Integration Without Guessed API Calls

The README's table of contents includes a C example, a C++ example and an API section, but the README excerpt stops before the actual example bodies and function signatures. For that reason, this article does not reproduce an invented installation command or an invented `main` function.

The practical first use is still specific. Choose the C API when the calling code is C, or compile the optional C++ API when C++11 is acceptable. Create a bitmap through the documented API, insert the application's integer identifiers, use the relevant membership and set-operation functions, and serialize the result only through the documented serialization interface. Then read the serialized bytes in a test or another supported implementation to confirm interoperability.

The first test should use sparse values rather than a dense range. Include values that exercise empty regions, clustered values and values crossing the boundaries used by the implementation. Verify equality after serialization and compare results from intersection, union and difference operations with a simple reference set. The repository includes `tests/` and `fuzz/`, which indicates dedicated test and fuzzing coverage, but the README does not state a test command or a coverage result.

SIMD Dispatch, Allocators and Thread Safety

CRoaring offers hardware-specific implementations rather than treating SIMD as a single portable switch. AVX2, AVX-512 and NEON are named explicitly in the project description. On x64, runtime dispatch is documented, so a binary can detect CPU capabilities and call optimized functions where available. This is useful for deployments that need one artifact across different x64 machines, but it does not remove the need to test the target hardware and compiler combination.

The README also contains sections on SIMD-related throttling and custom memory allocators. That indicates that execution tuning and memory management are explicit project concerns. The README does not provide the names or defaults for allocator hooks, nor does it define a throttling control that can be safely quoted. An integration should therefore inspect the API documentation before assuming that allocator callbacks are optional, reentrant or safe across threads.

Thread safety is another boundary. The README includes a dedicated thread-safety section, but its contents are not present in the README excerpt. It would be incorrect to infer that independent bitmaps, concurrent reads, concurrent writes or shared serialization are all safe. Keep ownership in one component unless the project documentation explicitly permits another arrangement.

Maintenance, Licence and Upgrade Boundaries

The repository is not archived. Its last push was on 2026-10-16, and the recent release list includes `v5.2.4` on 2026-10-15, `v5.2.3` on 2026-10-04 and `v5.2.2` on 2026-09-17. These dates show recent repository activity and recent tagged releases, but they do not by themselves define compatibility guarantees for an application.

The licence is listed as “Other” because GitHub cannot classify it, and the repository points readers to `LICENSE`. This is a material adoption issue. A team must read that file and assess its obligations for the intended distribution model, internal use and any redistribution of derived code. This article does not interpret the licence or provide legal advice.

CRoaring's upgrade cost depends on the integration surface. A CMake or package-based dependency can introduce a version decision, while an amalgamation file may create an update step that is separate from the upstream repository. Native code also makes compiler, architecture and SIMD configuration part of release testing. The repository's `tests/`, `fuzz/` and CI workflow files indicate engineering support for verification, but the README does not give supported version ranges or a backwards-compatibility policy.

CRoaring Versus Conventional Bitmap Choices

The main alternative is a conventional bitmap implementation such as WAH, EWAH or Concise, all of which the README names as comparison points. CRoaring's stated goal is to stay close to current hardware and use SIMD optimizations, including runtime dispatch on x64. That makes it a reasonable candidate when bitmap operations sit on a hot path and the application can manage a native dependency.

A conventional bitset remains conceptually simpler when the integer domain is small, dense or fixed and application simplicity matters more than compression. CRoaring is also not a replacement for an index that needs secondary keys, persistence, transactions or distributed coordination. Its scope is the set representation and operations around that representation.

The choice should therefore be workload-based rather than based on the list of systems named in the README. Confirm the domain width, density, operation mix, serialization requirements, deployment architecture and licence constraints before adopting CRoaring. The project supplies a specialized low-level data structure, not a complete data-management layer.

Editorial conclusion

CRoaring suits C or C++ services that repeatedly process sparse integer sets and can tolerate a custom-licence review. It is a poor fit for a simple small-set use case or for teams that require a standard OSI-classified licence without checking LICENSE. Before adoption, verify the exact build method, allocator and thread-safety expectations for the integration, because those choices affect deployment and upgrade cost.

Frequently asked questions

Does CRoaring support C and C++?

Yes. CRoaring is primarily a C library and also provides an optional C++ API. The C++ API requires a compiler supporting C++11.

Which CPU optimizations does CRoaring use?

The project description names SIMD optimizations for AVX2, AVX-512 and NEON. On x64 systems, the README documents runtime dispatch based on detected CPU features.

How can I integrate CRoaring into a C or C++ project?

The README documents CMake, CMake FetchContent, Conan and vcpkg paths, as well as amalgamation or unity builds for users who do not want CMake. The README does not include the exact commands for those paths.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. RoaringBitmap/CRoaring on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/roaringbitmap-croaring.svg)](https://hysenlabs.com/projects/roaringbitmap-croaring)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/roaringbitmap-croaring.svg)](https://hysenlabs.com/projects/roaringbitmap-croaring)

Was this useful?