Times are the geometric mean of the language's median times over the 10 tests.
In-memory red-black tree (one entry per node, balanced by recolouring and rotations) mapping i64 keys to i64 values. 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
While writing these solutions the agents could run only the correctness tests (the same workloads at up to 100,000 entries, a few seconds per run). They could not run the timed workloads, time anything, or run any other program, so nothing here was tuned against the benchmark.
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 07:57 UTC-07:00
Machine Apple M3, 8 cores, 16 GB, macOS 27.0.1
Model was told 4,000,000 entries on Apple M4 Max (arm64), 36 GB (not what was measured)
Benchmark run time 13m 08s (C 0m 26s, C++ 0m 26s, Rust 0m 34s, Go 0m 30s, Zig 0m 27s, Swift 0m 22s, Java 0m 35s, C# 0m 38s, Node.js 0m 52s, Bun 0m 50s, Python 7m 29s)
4n inserts: four times, n ascending keys are inserted into an empty tree.
Insert, random
n inserts of random keys into an empty tree.
Get, present
2n lookups (2 passes over n random picks) of present keys, on a tree of n keys.
Get, absent
2n lookups (2 passes over n keys) of absent keys, on a tree of n keys.
Range, short
n/8 range queries that each return 100 entries, on a tree of n keys.
Range, long
200 range queries that each return n/10 entries, on a tree of n keys.
Delete, random half
n removes: 2 rounds that each remove n/2 of the keys of a tree of n keys, in random order. The keys are put back between rounds, untimed.
Delete, ascending all
5n removes: 5 rounds that each remove all n keys in ascending order, leaving an empty tree that must still be usable. The tree is refilled between rounds, untimed.
Mixed, read-heavy
n operations on a tree of n keys: 70% get, 12% insert, 12% remove, 6% range of about 32 entries.
Churn, write-heavy
3n operations (3 passes over a stream of n) on an initially empty tree over a domain of n/16 keys, alternating growing phases (75% insert) and shrinking phases (75% remove), with 15% get and 5% range.
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.