Times are the geometric mean of the language's median times over the 10 tests.
In-memory radix tree (a path-compressed trie) mapping byte-string keys to i64 values, with longest-prefix match, prefix counts and ordered prefix listings. Every implementation on this page was written by an AI model from the same prompt, then tested and timed by the same harness.
Results: gemini-4-neon_high
Entries n = 1,500,000
Samples 2 per cell (1 process × 2 timed repetitions, after 1 warm-up in each process)
Measured 2026-11-23 22:18 UTC-07:00
Machine Apple M3, 8 cores, 16 GB, macOS 27.0.1
Model was told 1,500,000 entries on Apple M3 (arm64), 16 GB (as measured)
Benchmark run time 8m 26s (C 0m 13s, C++ 0m 16s, Rust 0m 14s, Go 0m 17s, Zig 0m 14s, Swift 0m 23s, Java 0m 19s, C# 0m 24s, Node.js 0m 47s, Bun 0m 37s, Python 4m 42s)
Median time per case (ms)
Case
C
C++
Rust
Go
Zig
Swift
Java
C#
Node.js
Bun
Python
Insert, random
3481.01×
4511.30×
3641.05×
4211.22×
3631.05×
4311.25×
4031.16×
3461.00×
5671.64×
5331.54×
6,62519.16×
Get, present
3261.05×
3561.15×
3221.04×
3921.27×
3091.00×
3741.21×
3801.23×
3901.26×
5801.88×
5841.89×
1,9086.18×
Get, near misses
1341.00×
1851.38×
1561.16×
2251.68×
1491.11×
2291.71×
2201.64×
2071.54×
3562.66×
2892.16×
1,43710.72×
Longest prefix
1471.00×
1861.26×
1581.08×
2281.55×
1591.08×
2311.57×
2281.55×
2171.48×
3982.71×
3822.60×
1,96613.37×
Prefix count
2271.03×
3061.39×
2201.00×
3361.53×
2271.03×
3111.41×
2971.35×
3271.49×
5092.32×
3711.69×
2,52311.49×
Autocomplete
2321.00×
2831.22×
2411.04×
3001.29×
3441.48×
3171.37×
3481.50×
3421.47×
5572.40×
5282.28×
4,82620.79×
Scan subtrees
1301.00×
2862.20×
2131.64×
3182.45×
3412.62×
2722.09×
3672.83×
3612.78×
7255.58×
6294.84×
7,09754.64×
Remove all
3661.00×
4501.23×
3941.08×
5081.39×
4011.10×
4921.34×
4571.25×
4601.26×
6351.73×
5941.62×
2,7457.50×
Mixed
3221.05×
3671.19×
3131.02×
4061.32×
3081.00×
3791.23×
3911.27×
3881.26×
5781.88×
5941.93×
2,1326.91×
Churn, small tree
3361.00×
4221.25×
3601.07×
4241.26×
3461.03×
4541.35×
4211.25×
4271.27×
6181.84×
5461.62×
3,82911.38×
Overall (geometric mean)
2391.00×
3151.32×
2611.09×
3451.44×
2811.18×
3381.41×
3421.43×
3371.41×
5422.27×
4912.06×
3,04812.76×
Median time per case, log scale (ms)
Insert, randomGet, presentGet, near missesLongest prefixPrefix countAutocompleteScan subtreesRemove allMixedChurn, small tree
n inserts: the n keys are inserted in random order into an empty tree, which splits edges as it grows.
Get, present
n lookups of keys that are present, in random order, on a tree of n keys.
Get, near misses
n lookups of absent keys that share long prefixes with present ones (a present key with "/0" appended, with its last byte changed, or with another numeric tail), on a tree of n keys.
Longest prefix
n longest-prefix queries on a tree of n keys, as a routing table is queried: present and absent keys, extended by digits, a path segment or binary bytes.
Prefix count
4n counts (4 passes of n) of the keys that start with a prefix cut from a random key at a random length, so the answer ranges from one key to the whole tree.
Autocomplete
2n prefix listings (2 passes of n) with a limit of 8: the values of the first 8 keys, in key order, that start with a prefix of a random key.
Scan subtrees
8 passes that each read every value of 401 large subtrees in key order (the whole tree, its 16 first-level and 384 second-level subtrees): about 22n values from a tree of n keys.
Remove all
n removes that take all n keys out of a tree in random order, merging nodes until the tree is empty.
Mixed
n operations on a tree of about n keys, over a domain of 2n keys: 60% get, 10% longest prefix, 5% prefix count, 5% prefix listing (limit 4), 10% insert, 10% remove.
Churn, small tree
3n inserts and removes (half each) of random keys from a domain of 32,768 on a tree of about 16,384 keys that stays inside the CPU caches, splitting and merging nodes all the time.
Method
Each language has a benchmark-owned driver (a line-for-line port of one canonical driver, in lang/) that calls the model-written data structure. The model does not write or control any timing code.
The driver times only the loop of operations, with an in-process monotonic clock. Process and runtime start-up, workload generation, pre-populating the structure, and verification are outside the timed region.
Every process runs a discarded warm-up repetition first (which is when a JIT compiles the hot code), then the timed repetitions, each on a freshly built structure. The number of processes and repetitions is the same for every language. Garbage-collected runtimes get one explicit collection before the timer starts; collections during the timed loop are counted.
Every repetition's results are checked against a reference, so a time is only reported for a correct run.
A language's overall score is the geometric mean of its median times over all cases. Unlike a total, that gives every case the same weight however long it runs, and being twice as slow on any one case costs the same. A language is only ranked if it completed every case.
All languages are compiled with fixed optimising flags and run single-threaded; see the README for the exact commands.