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: claude-opus-5-5_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 09:08 UTC-07:00
Machine Apple M3, 8 cores, 16 GB, macOS 27.0.1
Model was told 2,000,000 entries on Apple M4 Max (arm64), 36 GB (not what was measured)
Benchmark run time 9m 46s (C 0m 19s, C++ 0m 19s, Rust 0m 19s, Go 0m 21s, Zig 0m 21s, Swift 0m 24s, Java 0m 31s, C# 0m 24s, Node.js 0m 53s, Bun 0m 36s, Python 5m 20s)
Median time per case (ms)
Case
C
C++
Rust
Go
Zig
Swift
Java
C#
Node.js
Bun
Python
Insert, random
4531.15×
4601.17×
4991.27×
5691.45×
5071.29×
5141.31×
6341.61×
3931.00×
6291.60×
4891.24×
4,34811.06×
Get, present
3881.03×
4011.06×
3881.03×
3831.01×
3851.02×
3771.00×
5271.40×
3821.01×
7111.89×
5671.50×
2,7757.36×
Get, near misses
2171.04×
2261.08×
2161.03×
2351.12×
2461.17×
2261.08×
3801.81×
2101.00×
4312.05×
2751.31×
2,40911.48×
Longest prefix
2381.12×
2461.16×
2521.18×
2681.26×
2631.24×
2341.10×
4191.97×
2131.00×
4502.12×
3281.55×
2,79613.16×
Prefix count
3151.00×
3171.01×
3651.16×
3471.10×
4021.28×
3491.11×
4411.40×
3331.06×
5791.84×
3641.15×
3,39510.78×
Autocomplete
3821.25×
3611.19×
3041.00×
3291.08×
4211.38×
3581.18×
5711.88×
3531.16×
7382.43×
4541.49×
7,76225.52×
Scan subtrees
4331.67×
3281.26×
2591.00×
3951.52×
3971.53×
2851.10×
7873.03×
3741.44×
1,2514.82×
7592.93×
9,67737.30×
Remove all
4811.14×
5051.19×
5351.26×
5651.33×
5031.19×
5021.18×
6381.51×
4241.00×
6981.65×
5411.28×
3,4268.09×
Mixed
4441.12×
4211.06×
3971.00×
4181.05×
4271.08×
4391.11×
5151.30×
4051.02×
6991.76×
5721.44×
3,1247.88×
Churn, small tree
3981.04×
3831.00×
4141.08×
4341.13×
4791.25×
4301.12×
5381.41×
4131.08×
6871.80×
4781.25×
5,26813.77×
Overall (geometric mean)
3631.07×
3551.04×
3491.02×
3801.12×
3931.15×
3581.05×
5341.57×
3401.00×
6591.94×
4641.36×
4,04411.88×
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.