Times are the geometric mean of the language's median times over the 10 tests.
In-memory array-based binary min-heap (a priority queue) of entries with an i64 key and an i64 value. 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 = 3,000,000
Samples 2 per cell (1 process × 2 timed repetitions, after 1 warm-up in each process)
Measured 2026-11-23 21:25 UTC-07:00
Machine Apple M3, 8 cores, 16 GB, macOS 27.0.1
Model was told 3,000,000 entries on Apple M3 (arm64), 16 GB (as measured)
Benchmark run time 11m 12s (C 0m 08s, C++ 0m 08s, Rust 0m 08s, Go 0m 11s, Zig 0m 08s, Swift 0m 08s, Java 0m 14s, C# 0m 12s, Node.js 0m 57s, Bun 0m 53s, Python 8m 04s)
Median time per case (ms)
Case
C
C++
Rust
Go
Zig
Swift
Java
C#
Node.js
Bun
Python
Push, random
2191.41×
1551.00×
2071.33×
2511.61×
2101.35×
2131.37×
3041.95×
2711.74×
7174.61×
1,2407.98×
4,86331.28×
Push, descending
1631.07×
1521.00×
1551.02×
1741.14×
1561.02×
1611.06×
3042.00×
2461.62×
2,29215.07×
1,2198.02×
15,664103.00×
Build
1071.00×
1391.30×
1641.54×
2142.00×
1371.28×
1351.26×
2532.37×
2362.21×
2382.22×
2972.77×
4,68943.82×
Pop all
2171.00×
2261.04×
2431.12×
3331.53×
2281.05×
2651.22×
4091.88×
2571.18×
1,0945.03×
4091.88×
9,92745.66×
Hold (pop, push)
3441.00×
3521.02×
3671.07×
4471.30×
3501.02×
4161.21×
4971.44×
3911.14×
1,2593.66×
7442.16×
11,75834.17×
Hold (replace)
3791.10×
3901.13×
3851.12×
4271.24×
3441.00×
4161.21×
4801.39×
5761.67×
7752.25×
7152.08×
11,36733.02×
K-way merge
3161.09×
2891.00×
3171.10×
6982.41×
3341.16×
3071.06×
6102.11×
8172.83×
7482.59×
1,2564.35×
12,89744.61×
Top k of a stream
1861.12×
1741.05×
1821.09×
2191.32×
2001.20×
1661.00×
2601.56×
2691.61×
4112.47×
8234.95×
8,47450.92×
Sort in blocks
1521.13×
1351.00×
1511.12×
2561.90×
1611.20×
1411.05×
3052.27×
1831.36×
9757.25×
5564.13×
5,65542.02×
Mixed
2901.04×
2791.00×
2921.05×
3691.32×
3041.09×
3291.18×
4231.51×
3501.25×
7782.79×
6172.21×
7,99128.61×
Overall (geometric mean)
2211.04×
2131.00×
2331.09×
3111.46×
2291.08×
2341.10×
3691.73×
3241.52×
7923.72×
7143.35×
8,64840.57×
Median time per case, log scale (ms)
Push, randomPush, descendingBuildPop allHold (pop, push)Hold (replace)K-way mergeTop k of a streamSort in blocksMixed
8n pushes: 8 times, n entries with random keys are pushed into an empty heap, which grows as it goes.
Push, descending
6n pushes: 6 times, n entries with descending keys are pushed into an empty heap, so every new entry travels from a leaf all the way to the root.
Build
12 builds of a heap from n entries in random order (12n entries in all).
Pop all
n pops that empty a heap of n entries, which returns them in ascending order (the second half of a heap sort).
Hold (pop, push)
n steps on a heap of n entries, each a pop of the smallest entry followed by a push of a new, somewhat larger one (the event queue of a simulation).
Hold (replace)
The same n steps as the hold case, each done with one replace instead of a pop and a push.
K-way merge
A k-way merge of 4096 sorted runs holding 4n entries in all: 4n steps that each peek at the smallest entry and replace it with the next entry of the same run. The heap holds 4096 entries and stays inside the CPU caches.
Top k of a stream
Keeping the n/4 largest of a stream of 4n random entries: n/4 pushes, then a push_pop for each of the remaining entries.
Sort in blocks
4n operations: 2 passes that sort the n entries in blocks of 1024 by pushing a block and popping it all, on one heap that is emptied again and again.
Mixed
2n operations on a heap of n entries: 50% push, 40% pop, 10% peek. Keys come from a domain of n/16 values, so many entries share a key and are ordered by value.
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.