libart++

The adaptive radix tree map for modern C++.
std::map's interface, with cost counted in the unit that actually matters: at most one cold cacheline per level, and levels bounded by your key's bytes — never by your data's size.

header-only C++20 zero dependencies allocator-aware · PMR fuzzed vs std::map fault-injection tested
// the interface you already know
#include <artpp/map.hpp>

artpp::map<std::string, uint64_t> m;   // takes string_view args: no temp strings
m.insert("alpha", 1);
m.try_emplace("beta", 2);                // present → untouched, nothing constructed

if (auto it = m.find(user_input); it != m.end())
    use(it->first, it->second);

for (const auto& [key, value] : m)       // ascending key order, always
    process(key, value);

Count cachelines, not comparisons

A lookup's real cost is its cold cacheline loads — every other instruction hides behind them. Big-O in comparisons flatters comparison trees; measured in cachelines, a B-tree lookup is O(log n) dependent misses. libart++ is engineered so each level of descent costs at most ONE cold line — and the level count is bounded by your key's bytes, not your data's size.

Headerless dispatch

The node's kind rides in the tagged pointer, so descent knows how to route before the node arrives: no header line load before the child slot load. One line per hop is the contract, not the goal.

Prefixes live in the header line

A compressed run is stored inside the cacheline the node already owns; the pointer tag hints when it must be read, and a prefix-free node never touches it. A separate prefix node exists only when the run does not fit the node's header line (7 bytes in a sparse router, 63 in a full one) — overflow, not the default. Path compression at zero extra lines.

Terminals cost almost nothing

Values ≤5 bytes pack inline in the handle bits — zero lines. A small leaf can live inside the routing setlist's own cacheline (no separate load at all). Anything else sits in a dedicated 16-byte-aligned terminal region — a leaf is pure payload, so it gets exactly what it needs, not a 128-byte line.

Levels collapse adaptively

Sparse byte levels fuse: wide stems consume two key bytes per line, buckets pack whole key tails into one 4-line page, dense spans direct-index. The tree spends lines where your data's entropy actually is.

Measured on two machines

One templated benchmark engine drives every contestant through identical code — same keys, same op sequence, same checksums. Upstream libart is vendored; absl::btree_map and std::map use heterogeneous lookup. The numbers are for release 0.1.0, measured 2026-11-28 on an Apple M5 Max and on an x86-64 Linux server (AMD EPYC-Turin). Where artpp is slower than a baseline, the charts and tables show it and the text says so. Reproduce with -DARTPP_BENCHMARKS=ON.

1.14–1.97×
point lookups against libart on the Apple M5 Max: faster on all four workloads with both allocators
0.68–3.49×
point lookups against libart on the x86-64 server: 1.06–1.11× dictionary, 0.96–1.05× clustered, 1.44–3.49× sequential, and 0.68–0.78× on uniform random integers, which is slower
4.24–4.77×
faster lookups than unodb on 32-byte keys, both machines; inserts 2.16–4.01×, lower_bound 1.94–4.90×
0.87–3.47×
point lookups against absl::btree_map across both machines (M5 1.72–3.13×, x86 0.87–3.47×; below 1 is slower)

Point lookups (present keys, random order)

Point lookup latency, dictionary words, Apple M5 Max, median ns: artpp::map (line_pool) 110, artpp::map<buckets> 94.6, artpp::map (std::allocator) 111, libart 126, absl::btree_map 194, std::map 236
Point lookup latency, dictionary words, AMD EPYC-Turin, median ns: artpp::map (line_pool) 87.8, artpp::map<buckets> 82.0, artpp::map (std::allocator) 91.7, libart 97.5, absl::btree_map 213, std::map 242
Point lookup latency, clustered strings, Apple M5 Max, median ns: artpp::map (line_pool) 129, artpp::map<buckets> 169, artpp::map (std::allocator) 129, libart 173, absl::btree_map 311, std::map 486
Point lookup latency, clustered strings, AMD EPYC-Turin, median ns: artpp::map (line_pool) 320, artpp::map<buckets> 376, artpp::map (std::allocator) 351, libart 338, absl::btree_map 980, std::map 1397
Point lookup latency, uniform u64, Apple M5 Max, median ns: artpp::map (line_pool) 41.5, artpp::map<buckets> 42.1, artpp::map (std::allocator) 43.2, libart 53.0, absl::btree_map 90.1, std::map 196
Point lookup latency, uniform u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 107, artpp::map<buckets> 68.8, artpp::map (std::allocator) 127, libart 86.7, absl::btree_map 109, std::map 227
Point lookup latency, sequential u64, Apple M5 Max, median ns: artpp::map (line_pool) 24.4, artpp::map<buckets> 54.4, artpp::map (std::allocator) 33.1, libart 47.5, absl::btree_map 76.4, std::map 166
Point lookup latency, sequential u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 28.3, artpp::map<buckets> 161, artpp::map (std::allocator) 69.1, libart 98.7, absl::btree_map 97.8, std::map 225

Left: Apple M5 Max. Right: the x86-64 server. The charts' artpp::map row is the bundled line_pool allocator, artpp::map<buckets> is mode::buckets on the same allocator, and the std::allocator row is the map with no setup. Bars are the median of 7 runs. Point lookups against libart: on the Apple M5 Max 1.14–1.97× faster on all four workloads with both allocators; on the x86-64 server 1.06–1.11× on dictionary words, 0.96–1.05× on clustered strings, 1.44–3.49× on sequential integers and 0.68–0.78× on uniform random integers, which is slower. Against the comparison-based maps, point lookups are 1.72–3.13× absl::btree_map and 2.15–6.83× std::map on the M5, and 0.87–3.47× and 1.79–8.05× on the x86-64 server (below 1 is slower: uniform random integers with std::allocator). On uniform random integers line_pool lookups are 1.03× the std::allocator map's speed on the M5 and 1.18× on the x86-64 server: line_pool is not slower on uniform keys on either machine. The cause of the difference between the two machines is not yet known; huge pages were tried on the x86-64 server and did not help. The table gives every ratio; a range in parentheses is the spread over the runs where it exceeds 10 %.

workloadallocatorM5 nsM5 vs libartM5 vs absl::btree_mapM5 vs std::mapx86 nsx86 vs libartx86 vs absl::btree_mapx86 vs std::map
dictionary wordsline_pool110 (103–119)1.14× (1.04–1.18)1.80×2.19× (1.88–2.44)87.81.11×2.42×2.73×
std::allocator1111.14×1.72× (1.66–2.00)2.15× (2.07–2.32)91.71.06×2.33×2.63×
clustered stringsline_pool1291.35×2.42×3.85× (3.61–4.14)320 (320–356)1.05× (0.95–1.06)3.02× (2.77–3.08)4.33× (3.92–4.39)
std::allocator129 (126–141)1.34×2.37×3.83× (3.65–4.04)3510.96×2.80×3.96×
uniform u64line_pool41.51.27×2.20× (2.04–2.64)4.68×107 (106–143)0.78× (0.61–0.82)1.02× (0.76–1.05)2.09× (1.59–3.24)
std::allocator43.21.24×2.13× (2.00–2.64)4.54× (4.46–4.93)127 (123–137)0.68× (0.61–0.70)0.87× (0.80–0.89)1.79× (1.71–2.54)
sequential u64line_pool24.4 (23.7–26.9)1.97×3.13× (2.92–3.45)6.83× (6.28–7.03)28.3 (27.4–42.7)3.49× (2.44–3.83)3.47× (2.31–3.64)8.05× (5.28–9.17)
std::allocator33.1 (31.3–36.8)1.44× (1.34–1.55)2.40× (2.21–2.53)5.03× (4.60–5.43)69.11.44×1.43×3.29× (3.26–3.64)

Where artpp is slower on lookups (every cell below 1):

lower_bound (position at the next-greater key)

lower_bound latency, dictionary words, Apple M5 Max, median ns: artpp::map (line_pool) 82.5, artpp::map<buckets> 72.0, artpp::map (std::allocator) 86.6, libart unsupported, absl::btree_map 78.8, std::map 79.5
lower_bound latency, dictionary words, AMD EPYC-Turin, median ns: artpp::map (line_pool) 83.8, artpp::map<buckets> 72.4, artpp::map (std::allocator) 85.0, libart unsupported, absl::btree_map 101, std::map 123
lower_bound latency, clustered strings, Apple M5 Max, median ns: artpp::map (line_pool) 203, artpp::map<buckets> 229, artpp::map (std::allocator) 203, libart unsupported, absl::btree_map 273, std::map 330
lower_bound latency, clustered strings, AMD EPYC-Turin, median ns: artpp::map (line_pool) 363, artpp::map<buckets> 388, artpp::map (std::allocator) 553, libart unsupported, absl::btree_map 913, std::map 1145
lower_bound latency, uniform u64, Apple M5 Max, median ns: artpp::map (line_pool) 102, artpp::map<buckets> 96.9, artpp::map (std::allocator) 108, libart unsupported, absl::btree_map 93.8, std::map 196
lower_bound latency, uniform u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 181, artpp::map<buckets> 126, artpp::map (std::allocator) 226, libart unsupported, absl::btree_map 111, std::map 209
lower_bound latency, sequential u64, Apple M5 Max, median ns: artpp::map (line_pool) 16.5, artpp::map<buckets> 26.9, artpp::map (std::allocator) 17.0, libart unsupported, absl::btree_map 27.6, std::map 21.3
lower_bound latency, sequential u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 21.5, artpp::map<buckets> 34.4, artpp::map (std::allocator) 25.1, libart unsupported, absl::btree_map 28.2, std::map 22.9

Positioning at the next-greater key is the query an ordered map adds over a hash map. libart has no such call (shown as unsupported). Against absl::btree_map, artpp's lower_bound is 0.87–1.67× its speed on the M5 and 0.49–2.52× on the x86-64 server, depending on the workload: faster on clustered strings and sequential integers on both machines, slower on uniform random integers on both. Where artpp is slower (ratios are artpp's speed relative to the baseline; the README has the full table):

Inserts (bulk build)

Insert latency, dictionary words, Apple M5 Max, median ns: artpp::map (line_pool) 94.9, artpp::map<buckets> 95.3, artpp::map (std::allocator) 118, libart 82.2, absl::btree_map 74.4, std::map 126
Insert latency, dictionary words, AMD EPYC-Turin, median ns: artpp::map (line_pool) 97.9, artpp::map<buckets> 102, artpp::map (std::allocator) 142, libart 72.5, absl::btree_map 117, std::map 255
Insert latency, clustered strings, Apple M5 Max, median ns: artpp::map (line_pool) 170, artpp::map<buckets> 201, artpp::map (std::allocator) 198, libart 188, absl::btree_map 268, std::map 406
Insert latency, clustered strings, AMD EPYC-Turin, median ns: artpp::map (line_pool) 382, artpp::map<buckets> 417, artpp::map (std::allocator) 501, libart 349, absl::btree_map 1103, std::map 1216
Insert latency, uniform u64, Apple M5 Max, median ns: artpp::map (line_pool) 48.1, artpp::map<buckets> 62.5, artpp::map (std::allocator) 58.9, libart 54.2, absl::btree_map 94.7, std::map 225
Insert latency, uniform u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 70.6, artpp::map<buckets> 90.4, artpp::map (std::allocator) 83.1, libart 102, absl::btree_map 123, std::map 322
Insert latency, sequential u64, Apple M5 Max, median ns: artpp::map (line_pool) 10.4, artpp::map<buckets> 36.9, artpp::map (std::allocator) 14.2, libart 19.8, absl::btree_map 29.1, std::map 81.2
Insert latency, sequential u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 18.1, artpp::map<buckets> 135, artpp::map (std::allocator) 21.1, libart 32.6, absl::btree_map 42.2, std::map 93.2

Both allocators are on the charts. The same tree on line_pool builds 1.14–1.37× as fast as on std::allocator on the M5 and 1.17–1.45× on the x86-64 server. Against libart the result depends on the keys: dictionary words build more slowly on both machines, sequential integers faster on both. Where artpp is slower (ratios are artpp's speed relative to the baseline; the README has the full table):

Ordered scans (full in-order traversal)

Ordered scan, ns per element, dictionary words, Apple M5 Max, median ns: artpp::map (line_pool) 8.4, artpp::map<buckets> 2.7, artpp::map (std::allocator) 8.1, libart 6.3, absl::btree_map 1.0, std::map 4.8
Ordered scan, ns per element, dictionary words, AMD EPYC-Turin, median ns: artpp::map (line_pool) 8.5, artpp::map<buckets> 3.2, artpp::map (std::allocator) 9.0, libart 8.4, absl::btree_map 2.0, std::map 5.3
Ordered scan, ns per element, clustered strings, Apple M5 Max, median ns: artpp::map (line_pool) 18.4, artpp::map<buckets> 8.6, artpp::map (std::allocator) 19.1, libart 16.0, absl::btree_map 9.3, std::map 64.5
Ordered scan, ns per element, clustered strings, AMD EPYC-Turin, median ns: artpp::map (line_pool) 38.5, artpp::map<buckets> 15.7, artpp::map (std::allocator) 48.6, libart 39.1, absl::btree_map 25.1, std::map 164
Ordered scan, ns per element, uniform u64, Apple M5 Max, median ns: artpp::map (line_pool) 15.8, artpp::map<buckets> 3.8, artpp::map (std::allocator) 19.4, libart 13.7, absl::btree_map 2.5, std::map 61.4
Ordered scan, ns per element, uniform u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 51.4, artpp::map<buckets> 6.0, artpp::map (std::allocator) 61.2, libart 43.8, absl::btree_map 3.3, std::map 157
Ordered scan, ns per element, sequential u64, Apple M5 Max, median ns: artpp::map (line_pool) 1.6, artpp::map<buckets> 9.1, artpp::map (std::allocator) 2.0, libart 1.7, absl::btree_map 0.7, std::map 3.9
Ordered scan, ns per element, sequential u64, AMD EPYC-Turin, median ns: artpp::map (line_pool) 2.5, artpp::map<buckets> 20.1, artpp::map (std::allocator) 6.8, libart 6.2, absl::btree_map 1.7, std::map 4.0

Full in-order traversals (artpp through for_each_value). In the default mode artpp scans more slowly than absl::btree_map in 16 of 16 cells. mode::buckets stores key tails in packed pages: on dictionary words it scans 2.62–3.10× as fast as the default mode, and on clustered strings 1.10–1.57× as fast as absl::btree_map; on sequential integers it is slower than the default mode. Where artpp is slower (ratios are artpp's speed relative to the baseline; the README has the full table):

Methodology: measured 2026-11-28 on the release code (390e25c). M5: Apple M5 Max, macOS 26.3, Apple clang 17, -O3; the machine was in use (load averages 2.4–4.8 during the main suite; the three 32-byte-key runs started at 2.9, 44.2, 2.9). x86: AMD EPYC-Turin virtual machine (16 vCPUs), x86-64 Linux, clang++ 20, libstdc++ 15, -O3, pinned to one core; load average under 2.5. The main suite ran 7 times per machine: times are medians, ratios are medians of the per-run ratios. The 32-byte-key numbers are the minimum over the runs. Workloads: dictionary words (each machine's own /usr/share/dict/words: 236k words on the M5, 104k on the x86 server, so the dictionary rows compare the contestants on one machine and not the two machines with each other), 885k clustered strings, 1M uniform random and 1M sequential uint64_t (typed APIs; libart receives the identical big-endian bytes). Data: results-m5.csv, results-x86.csv, raw runs and the script that produced every number on this page · engine: bench/engine.hpp. A regression gate compares the working tree with a baseline commit on this same benchmark (interleaved runs, paired ratios); it is run by hand on a quiet machine, not in CI.

32-byte keys, and unodb

Many real keys do not fit in a CPU register: hashes, UUIDs, composite tuples. This benchmark stores random 32-byte keys and adds two contestants to the field: unodb, the other general-purpose C++ ART, and std::unordered_map.

Random 32-byte keys, 10M of them, each container built and measured on its own; nanoseconds per operation (per element for scans), minimum over the runs (3 on the M5, 2 on the x86 server). unodb ran on the identical keys as unodb::db<unodb::key_view, std::uint64_t>. art_map is absent: the benchmark source records that it does not compile for a key longer than 16 bytes.

ns per opM5 insertM5 hitM5 scanM5 lower_boundx86 insertx86 hitx86 scanx86 lower_bound
artpp::map (line_pool)111.668.217.15119.6235.9211.459.72361.2
artpp::map (std::allocator)152.068.318.13127.8381.3216.955.04380.5
libart140.492.813.03n/a665.3163.441.99n/a
unodb447.2325.0212.26585.9823.6920.7309.24738.6
absl::btree_map1040.81071.310.491034.11914.01888.043.332049.6
std::map1378.81387.872.931393.62123.73274.5210.113377.4
std::unordered_map202.291.7n/an/a1092.9280.6n/an/a

How many times faster artpp is (below 1 is slower):

artpp allocatortimes faster thanM5 insertM5 hitM5 scanM5 lower_boundx86 insertx86 hitx86 scanx86 lower_bound
line_poolunodb4.01×4.77×12.38×4.90×3.49×4.36×5.18×2.04×
libart1.26×1.36×0.76×n/a2.82×0.77×0.70×n/a
absl::btree_map9.33×15.71×0.61×8.65×8.11×8.93×0.73×5.67×
std::map12.35×20.35×4.25×11.65×9.00×15.49×3.52×9.35×
std::unordered_map1.81×1.34×n/an/a4.63×1.33×n/an/a
std::allocatorunodb2.94×4.76×11.71×4.58×2.16×4.24×5.62×1.94×
libart0.92×1.36×0.72×n/a1.74×0.75×0.76×n/a
absl::btree_map6.85×15.69×0.58×8.09×5.02×8.70×0.79×5.39×
std::map9.07×20.32×4.02×10.90×5.57×15.10×3.82×8.88×
std::unordered_map1.33×1.34×n/an/a2.87×1.29×n/an/a

Against unodb, on random 32-byte keys, 10M of them, lookups are 4.76–4.77× (M5) and 4.24–4.36× (x86) faster, inserts 2.94–4.01× (M5) and 2.16–3.49× (x86), ordered scans 11.71–12.38× (M5) and 5.18–5.62× (x86) and lower_bound 4.58–4.90× (M5) and 1.94–2.04× (x86); the ranges cover both allocators. Against libart, lookups are 1.36× its speed on the M5 and 0.75–0.77× on the x86-64 server, where artpp is slower. Ordered scans are slower than libart's and absl::btree_map's on both machines.

Earlier measurements, not repeated for this release. Until 0.1.0 this page showed runs from June 2026 on an Apple M5 Max, made with earlier code: the same 32-byte keys scaled from 1M to 100M keys, and a variant with fixed std::array keys. They were not measured again for 0.1.0, so their charts and numbers have been taken off the page. They remain in the repository history (docs/charts/buffer_*.svg, docs/charts/array_*.svg and docs/gen_buffer_charts.py before the 0.1.0 release commit).

In a file, against Boost.MultiIndex

A map on a file-backed line_pool is stored in a file and reopened without a rebuild. The usual C++ way to keep an ordered container in a mapped file is boost::multi_index_container in a Boost.Interprocess managed mapped file, so that is the comparison. Boost.MultiIndex offers what artpp does not: several indexes over one element, elements of any offset-pointer-aware type, MSVC. artpp validates and stamps its store and refuses one it cannot trust; Boost uses the segment as it finds it. The README has the full comparison.

artpp_bench_filebacked (bench/bench_filebacked.cpp) stores the four workloads of the main suite, the same keys in the same order, in a file with each contestant, each in its own new directory: 3 runs per machine, one process at a time (load averages before the runs: 1.18, 2.88, 2.19 on the M5, 1.26, 1.68, 1.76 on the x86-64 server); times are the median of the runs and "artpp faster" is the median of the per-run ratios, below 1 meaning slower. The stores were on local disks (APFS on the M5, ext4 on the x86-64 server). The page cache was warm throughout: the benchmark reopens a store moments after writing it, so the reopen figures measure mapping and validation, not reading from disk.

opworkloadM5 artpp nsM5 Boost.MultiIndex nsM5 artpp fasterx86 artpp nsx86 Boost.MultiIndex nsx86 artpp faster
insertdictionary words95.12062.16×1244183.35×
clustered strings1745243.08×4059782.41×
uniform u6450.04659.32×98.66366.05×
sequential u6410.823822.03×24.135614.93×
hitdictionary words1112872.63×87.32302.63×
clustered strings1245344.28×3229172.86×
uniform u6441.047612.18×1195954.98×
sequential u6423.340816.99×27.889231.63×
missdictionary words39.593.42.36×35.491.92.60×
clustered strings96.24574.75×2015712.84×
uniform u6416.146729.20×28.154919.62×
sequential u645.373.213.77×8.711513.24×
lower_bounddictionary words82.584.81.03×81.51061.30×
clustered strings1944442.30×3725541.48×
uniform u6499.04884.92×1965543.02×
sequential u6416.672.84.38×22.31145.14×
scandictionary words8.39.81.15×8.39.31.11×
clustered strings18.01005.74×38.91624.17×
uniform u6415.488.26.14×56.01402.49×
sequential u641.68.04.81×2.38.23.50×
erase (after reopen)dictionary words1995542.70×1605983.75×
clustered strings27511824.29×60017262.88×
uniform u641239327.55×32614104.32×
sequential u6463.678112.28×113155913.74×
hit after reopen, first passdictionary words1213002.53×95.32372.48×
clustered strings1315934.52×3498932.72×
uniform u6444.649911.53×1246575.65×
sequential u6432.342713.22×33.090027.30×
hit after reopendictionary words1072652.48×87.32302.61×
clustered strings1225754.73×3179142.88×
uniform u6440.450012.74×1116175.83×
sequential u6421.341719.44×27.887330.97×

Durability and reopening (a range in parentheses is the minimum and maximum over the runs). artpp's checkpoint() records the tree and forces nothing to disk; Boost's flush() is an asynchronous msync; "to disk" adds a synchronous msync for both; reopen is the time from opening the store to the first lookup's result.

workloadmachineartpp checkpoint() µsBoost flush() µsartpp to disk msBoost to disk msartpp close µsBoost close µsartpp reopen µsBoost reopen µs
dictionary wordsM50.9 (0.8–1.2)1411 (1345–4678)3.11 (3.09–3.23)1.46 (1.39–4.73)250 (239–278)108 (105–152)130 (113–156)49 (38–52)
x861.6 (1.6–1.6)2.5 (2.1–2.9)4.77 (3.52–5.22)3.31 (3.16–3.96)446 (114–493)115 (100–528)39 (36–48)30 (27–33)
clustered stringsM51.1 (0.8–1.2)4489 (4462–6087)8.46 (7.71–10.78)4.66 (4.64–6.20)390 (390–488)346 (294–375)146 (146–147)59 (58–62)
x861.9 (1.8–2.1)4.1 (3.2–4.2)19.76 (16.27–21.80)19.35 (18.89–19.53)2843 (700–3569)914 (500–961)78 (70–94)35 (35–51)
uniform u64M50.9 (0.9–1.0)3826 (3747–3892)9.81 (9.77–9.89)4.00 (3.97–4.03)684 (640–733)343 (312–400)143 (119–158)66 (65–66)
x862.5 (2.2–3.0)4.3 (4.0–5.0)22.43 (19.03–25.38)17.54 (14.17–18.76)4295 (838–4335)966 (904–1022)75 (62–82)61 (50–64)
sequential u64M50.9 (0.8–1.2)3851 (3704–4160)4.03 (3.88–4.65)4.04 (3.81–4.48)374 (352–488)361 (236–473)132 (130–141)53 (48–64)
x862.4 (2.3–2.5)4.6 (3.9–4.7)12.42 (9.39–12.53)18.26 (17.40–18.54)1609 (294–1743)886 (851–912)58 (50–76)43 (39–53)

Space: bytes allocated per key, and the size on disk.

workloadmachinekeysartpp used B/keyBoost used B/keyartpp files MiBartpp on disk MiBBoost on disk MiB
dictionary wordsM5235,97684.880.020.120.118.0
x86104,33484.980.012.18.48.0
clustered stringsM5884,61566.480.056.156.167.5
x86884,61566.480.056.155.968.0
uniform u64M51,000,00067.056.068.168.153.4
x861,000,00066.964.068.163.762.0
sequential u64M51,000,00026.256.028.128.153.4
x861,000,00026.264.028.124.962.0

Where artpp is behind Boost.MultiIndex:

In short: against boost::multi_index_container with one ordered index in a Boost.Interprocess mapped file, on the four workloads of the main suite, lookups are 2.63–16.99× faster on the M5 and 2.63–31.63× on the x86-64 server, inserts 2.16–22.03× and 2.41–14.93×, lower_bound 1.03–4.92× and 1.30–5.14×. Boost reopens a store sooner (49–66 µs to the first lookup against artpp's 130–146 µs on the M5; 30–61 µs against 39–78 µs on the x86-64 server), closes it sooner, and needs fewer bytes per key on dictionary words and uniform integers (84.79–84.90 against 80.00–80.01 B/key; 66.88–66.97 against 56.00–64.00 B/key), where artpp needs fewer on clustered strings and sequential integers (66.37–66.39 against 80.00 B/key; 26.17 against 56.00–64.00 B/key). Boost.MultiIndex holds several indexes over one element, which artpp does not.

Compared with other radix trees

Three other adaptive radix trees are the reference points: libart (C), unodb (C++20) and art_map (C++14). The measured results first, then what each library can and cannot do. The README has the sources for every statement.

libart. Point lookups against libart: on the Apple M5 Max 1.14–1.97× faster on all four workloads with both allocators; on the x86-64 server 1.06–1.11× on dictionary words, 0.96–1.05× on clustered strings, 1.44–3.49× on sequential integers and 0.68–0.78× on uniform random integers, which is slower.

unodb. Measured single-threaded, on random 32-byte keys, 10M of them, lookups are 4.76–4.77× (M5) and 4.24–4.36× (x86) faster, inserts 2.94–4.01× (M5) and 2.16–3.49× (x86), ordered scans 11.71–12.38× (M5) and 5.18–5.62× (x86) and lower_bound 4.58–4.90× (M5) and 1.94–2.04× (x86); the ranges cover both allocators.

art_map. Not measured: its keys are limited to 16 bytes, so it cannot run the string or 32-byte workloads. No speed claim is made against it.

What the C++ API adds over libart

libart (C)libart++ (artpp::map)
LanguageC: two files, about 800 lines; callable from C and from any language with a C foreign function interface C++20, header-only, GCC or Clang
Interfaceart_insert / art_search / art_delete on byte pointers and lengths the std::map interface: find, at, operator[], try_emplace, erase, swap, ==; artpp::set for keys only
Keysraw byte pointers + lengths; encoding is the caller's work string/string_view/integrals/byte vectors built in, integers in numeric order; other types through key_codec, doubles & reflected structs via psio
Valuesvoid* — the caller owns the lifetime typed T: constructed in place, destroyed on erase, moved on restructure, non-trivial and move-only types included; small ones live inline in the pointer
Iterationforward callbacks: art_iter, art_iter_prefix bidirectional iterators, reverse ranges, erase(iterator), range-for
Ordered queriesart_minimum / art_maximum; no lower_bound lower_bound / upper_bound / equal_range
Prefix iterationart_iter_prefix, one call no dedicated call: lower_bound(prefix), then iterate while the key starts with the prefix
Memorycalloc/free, fixed any standard allocator (PMR included); 4-byte indexed handles; mmap file-backed pools; cross-pool moves as one memcpy
Small leavesan allocated leaf per key a leaf that fits goes inside the routing node's cacheline (the 1-byte inl header flags which children are inline)
Path compressionper-node prefix read with the header on every hop prefix fused into the header line, read only when the pointer tag says one exists
Failure handlingC: no exceptions, manual cleanup basic/strong guarantees stated per operation; fault injection at every allocation point checks for leaks and double destruction
Deep treesinsert, delete, iteration and destroy recurse once per level no operation's stack use grows with the depth of the tree
Structureone fixed node ladder (4/16/48/256) selectable modes: buckets packs key tails into pages, dense_tiers and wide_stems trade footprint against hop depth — same semantics, same tests

The C++ ARTs, by what they can hold

librarykeysvaluesordered accessconcurrencyneeds
artpp::mapbyte strings up to 65535 bytes (a key may be a prefix of another), integers, any type with a key_codec any move-constructible type iterators, lower_bound / upper_bound none (thread safety of a standard container) C++20, GCC or Clang; no dependencies
unodbintegral keys (its README: only uint64_t tested) or key_view; no key may be a prefix of another, so text goes through an encoder that truncates and pads byte spans, or a trivially copyable type scan callbacks: forward, reverse, from a key olc_db (concurrent), mutex_db C++20, Boost; SSE4.1 on Intel; GCC, Clang or MSVC
art_mapone integer of at most 16 bytes: no strings, no 32-byte keysnot examined for this release, and not measured

artpp is more general than art_map in the keys it holds, and more general than unodb in its keys and values; unodb has concurrent trees and MSVC support, which artpp does not. Nothing on this page says artpp is faster than art_map on the keys art_map supports: that was not measured.

Engineered like a standard library component

The goal is a container you could submit for review: exact contracts, systematic tests, documentation that states its limits.

Any key type

Strings, views, byte vectors, all integrals (numeric iteration order) built in. With psio: doubles, reflected structs, optionals, variants — one macro per type.

Structural modes

mode::buckets packs sparse key tails into cacheline pages (its numbers are in the README's bucket-mode table); dense_tiers and wide_stems trade footprint vs hop depth. Same semantics, tested identically.

Allocators, all the way down

Every node and value goes through your allocator — PMR works. Index-based pool handles shrink branches to 4 bytes, back the map with an mmap'd store directory, and make cross-pool moves a single memcpy.

Whole-tree ops use structure

Equality compares node-by-node (memcmp'd edges, no key materialization); cross-allocator moves clone node-by-node — never key-by-key rebuilds.

Exception safety, tested

Every allocation point is fault-swept with throwing values and failing allocators; leak, corruption, and double-destroy counters assert against a std::map oracle.

Bidirectional, bounded, complete

lower_bound / upper_bound / equal_range, reverse iteration, --end(), erase(iterator), structural ==, max_key_bytes guarded with length_error.

Thirty seconds of code

Integral keys iterate in numeric order

artpp::map<int64_t, std::string> m;
m.insert(-5, "negative");    // big-endian, sign-flipped
m.insert( 7, "positive");    // encoding: byte order ==
                              // numeric order, free
for (const auto& [k, v] : m)  // → -5, then 7
    log(k, v);

Floating-point keys do too — via psio

ARTPP_PSIO_KEY(double)        // order-preserving codec, one macro

artpp::map<double, std::string> m;
m.insert(-3.5, "a");          // IEEE sign-transform: byte
m.insert( 0.0, "b");          // order becomes numeric
m.insert( 2.25, "c");         // order — negatives and all
for (const auto& [k, v] : m) // → -3.5, 0.0, 2.25
    log(k, v);
// reflected structs, optionals, variants key the same way

File-backed, 4-byte branches

artpp::line_pool pool("mystore");   // a store directory
using A = artpp::pool_alloc<uint64_t>;
artpp::map<std::string_view, uint64_t,
           artpp::mode::none, A> t{A{&pool}, artpp::attach};
t.insert("key", 42);
t.checkpoint();           // what the next open sees
// branches cost 4 bytes; reopening is O(1):
// handles are offsets, the bytes are the tree

Pick the structure per workload

// dictionary-shaped keys? pack the tails:
artpp::map<std::string_view, uint64_t,
           artpp::mode::buckets> dict;
// measured in the README's bucket-mode table

Get started in one minute

Header-only. Copy include/artpp, or:

# CMake ≥ 3.20
include(FetchContent)
FetchContent_Declare(artpp GIT_REPOSITORY https://github.com/gofractally/libartpp.git
                     GIT_TAG main)
FetchContent_MakeAvailable(artpp)
target_link_libraries(your_target PRIVATE artpp::artpp)

# or hack on it directly
git clone https://github.com/gofractally/libartpp && cd libartpp
cmake -B build && cmake --build build -j && ctest --test-dir build
cmake -B build -DARTPP_BENCHMARKS=ON      # the compare suite from this page

Requirements: a C++20 compiler, a 64-bit little-endian target (ARM64/x86-64; NEON and SSE2 paths included), GCC or Clang. Nothing else (the optional psio key adapter needs C++23 and Boost headers). MIT licensed. Full API reference and contracts: the README.