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: 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 21:12 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 12m 15s (C 0m 22s, C++ 0m 21s, Rust 0m 20s, Go 0m 30s, Zig 0m 19s, Swift 0m 22s, Java 0m 30s, C# 0m 31s, Node.js 0m 43s, Bun 0m 47s, 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.