Back to .md Directory

Benchmarks

Since Okra is built on top of LMDB and exposes the same external key/value store interface, we can compare Okra's performance to using LMDB directly. The numbers here were produced on a 2021 M1 MacBook Pro with 32GB RAM running macos 13.1 with a 1TB SSD.

May 2, 2026
0 downloads
3 views
View source

Benchmarks

Since Okra is built on top of LMDB and exposes the same external key/value store interface, we can compare Okra's performance to using LMDB directly. The numbers here were produced on a 2021 M1 MacBook Pro with 32GB RAM running macos 13.1 with a 1TB SSD.

The entries are small, with 4-byte keys (monotonically increasing u32s) and 8-byte values (the Blake3 hash of a random seed).

ℹ️ The rough takeaway here is that, compared to native LMDB, Okra has similar performance for reads, similar performance for small batches of writes, and degrades quickly for large batches of writes.

Another way of looking at this is that the overhead of opening and commiting a transaction dominates the cost of actually doing any work inside the transaction, even for LMDB.

Okra benchmarks

zig build bench

1k entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00030.01290.00060.00131560525
get random 100 entries1000.01050.02350.01590.00576274825
iterate over all entries1000.03570.04930.04380.002822819724
set random 1 entry1000.06030.25890.08030.021512460
set random 100 entries1000.53271.07300.64980.0972153896
set random 1k entries104.43195.13834.79130.2259208713
set random 50k entries10232.6683250.3424240.24185.5001208124

50k entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00030.01270.00130.0012782001
get random 100 entries1000.01680.06530.02250.00844452612
iterate over all entries1000.88601.11721.01340.043649341029
set random 1 entry1000.06590.47630.09180.048010897
set random 100 entries1001.39591.73801.53520.070565138
set random 1k entries1010.625112.953911.84720.747484408
set random 50k entries10442.1694463.2281449.47767.6731111240

1m entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00080.02150.00200.0020489388
get random 100 entries1000.05680.13830.08330.02001201195
iterate over all entries10017.798823.154519.87171.112950322714
set random 1 entry1000.07800.42640.10090.03399911
set random 100 entries1002.20064.80624.33590.323123063
set random 1k entries1023.052731.538029.19603.027634251
set random 50k entries10692.9426713.3481701.46276.722271280

LMDB benchmarks

Copied from https://github.com/canvasxyz/zig-lmdb for reference.

1k entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00010.00690.00020.00074082799
get random 100 entries1000.00890.02040.01180.00458473664
iterate over all entries1000.01750.02900.02210.002345156084
set random 1 entry1000.04980.18140.05820.015917169
set random 100 entries1000.07500.12750.08410.00681189692
set random 1k entries100.24950.26060.25570.00353911596
set random 50k entries108.828112.44149.81831.14495092551

50k entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00020.00720.00110.0008914620
get random 100 entries1000.01940.05620.02320.00584312356
iterate over all entries1000.42430.77430.54510.031591727484
set random 1 entry1000.04460.30280.05770.026317342
set random 100 entries1000.36730.65410.47560.0776210273
set random 1k entries100.74990.90150.83790.04741193519
set random 50k entries1014.213014.781714.49310.17973449915

1m entries

iterationsmin (ms)max (ms)avg (ms)stdops / s
get random 1 entry1000.00040.02700.00250.0029397152
get random 100 entries1000.04400.17580.06680.01981496224
iterate over all entries1009.992513.885810.66770.513193741223
set random 1 entry1000.05380.37630.07210.037413874
set random 100 entries1000.65102.21531.74430.197157330
set random 1k entries106.996511.501110.27191.652997353
set random 50k entries1039.916442.665341.19311.00431213796

Related Documents