armon/libart logo

armon/libart

Free

Adaptive Radix Trees implemented in C

FreeFree tier
Type
Open Source

About armon/libart

libart is a C99 library that implements the Adaptive Radix Tree (ART), a data structure designed for efficient indexing in main-memory databases. It dynamically adjusts node sizes (4, 16, 48, 256) to minimize memory overhead—guaranteeing no more than 52 bytes per key—while offering O(k) operations, often outperforming hash tables due to better cache locality. The library supports minimum/maximum value lookups, prefix compression, ordered iteration, and prefix-based iteration. It is open-source, licensed under an unspecified open-source license, and includes test code and build instructions for integration into larger projects.

Key Features

C99 implementation of Adaptive Radix Tree (ART)
Four node sizes (4, 16, 48, 256) to adapt to data density
Guaranteed overhead of no more than 52 bytes per key
O(k) operations, often faster than hash tables due to cache locality
Minimum and maximum value lookups
Prefix compression and prefix-based iteration
Ordered iteration over keys

Pros & Cons

Pros
  • Cache-friendly design with O(k) operations, outperforming hash tables in many scenarios
  • Low and predictable memory overhead per key
  • Supports ordered iteration and prefix-based queries
  • Open-source and can be integrated into other projects
Cons
  • Requires C99 environment, not directly usable in interpreted languages without bindings
  • Not a full database; provides only the data structure implementation
  • Limited documentation beyond the README and source comments
  • No active releases or package management; must be built from source

Best For

Main-memory database indexingIn-memory key-value storageApplications requiring ordered traversal or prefix queriesPerformance-critical systems where cache efficiency matters

FAQ

How do I build libart?
The repository includes a Makefile and SConstruct. To build test code, first install libcheck (e.g., from deps/check-0.9.8) then run 'scons' and './test_runner'. Alternatively, you can skip installation and set LD_LIBRARY_PATH to the deps directory.
What license is libart under?
The repository includes a LICENSE file, indicating it is open-source, but the exact license is not explicitly stated in the README. Check the LICENSE file in the repository for details.
What are the node sizes used by ART?
ART uses four node sizes: 4, 16, 48, and 256, dynamically switching between them to balance space and performance.
Does libart support concurrent access?
The README does not mention thread safety. The library may require external synchronization for concurrent use.