The B-tree challenge · four levels, about three minutes
Joltrin Arena
Guess how fast Joltrin's B-tree is. Then run it and see how close you got.
The tree is the real Go code from this repository, compiled to WebAssembly and running on your device. Every number below is measured on your machine, in your browser, a few seconds ago. Nothing is sent anywhere.
Pick what you think will happen.
The real tree does the work and is timed.
See the numbers, what they mean, and where they stop meaning anything.
What this is, and what it is not
A browser run is useful for feeling how a B-tree behaves. It is not a benchmark of the Go library in production.
What you are measuring
- The in-memory B-tree (
inmemory.NewBtree) with integer keys and integer values, unique keys. - Go compiled to WebAssembly, so it runs slower than native Go would on the same machine.
- Each result is the median of 3 trials, and each trial repeats the work until it has run for at least 30 ms, so coarse browser clocks stay accurate.
- Keys come from a fixed seed (42), so the shuffled order is the same on every run.
What you are not measuring
- No disk, no transactions, no write-ahead log. The ACID, disk-backed store is a different code path and is benchmarked natively.
- One thread. There is no concurrency here.
- Nodes hold up to 8 items. The in-memory tree fixes that size, so you cannot tune it in this arena.
- Runs are capped at 100,000 keys to keep your browser responsive.
- Your device, browser, and whatever else is running change the numbers. They are yours, not a guarantee.
Run it natively
The disk-backed benchmark lives in the repository. These are the documented commands, from docs/BENCHMARKS.md.
go run ./tools/benchmark -count 10000 -slotlength 2000
go run ./tools/benchmark -count 100000 -slotlength 4000
Published native reference, not comparable to the numbers above
From the repository benchmark table: 100,000 items, slot length 2,000, on a 2015 MacBook Pro (dual-core Intel Core i5, 8 GB). It measured 132,805 inserts per second, 136,684 reads per second and 51,817 deletes per second. That run used the in-memory L2 cache with /tmp storage behind full ACID transactions, so it does more work per operation than this arena and ran on different hardware. Do not compare the two.
Optional: poke at it yourself
Open the sandbox and the raw output
Raw JSON from the last run:
No run yet.