Benchmarks

Every number on this page was measured through the public C API (include/lattice.h against a ReleaseFast liblattice), the way an application or a binding meets the database, with the options a user gets by default unless a row says otherwise. The program is tests/benchmark/capi_bench.c; the commands that produce these tables are under Reproducing.

Version0.17.0 (release/0.17.0 at 75de895), ReleaseFast. The two tables marked format 5 are the build after 0.18.1 (main at 9f087a04)
MachineApple M5, 10 cores, 24 GB, internal SSD, macOS 26.5
Date2026-11-13; the format-5 tables 2026-11-20 and 2026-11-22
Defaultswrite-ahead log on; sync mode full (the log is fsynced on every commit; plain fsync, not F_FULLFSYNC); 100 MB page cache; changefeed keeps every event; automatic checkpoint every 1,000 log frames (since format 5, every 3,200 with this cache)
Loadone thread; nothing else measuring or building, desktop applications open (load average about 2; about 4 on 2026-11-22)

Each row ran several times (five unless it says otherwise), each run a fresh process on a fresh database. A figure is the median of the runs; the range in brackets is the lowest and highest run. Within a run, p50 and p99 are taken over every timed operation. Times are wall-clock.

What was measured again, and what was not. The release after 0.18.1 changes how ids are stored (file format 5) and how a commit files new relationships, and both show in batched writes and bulk loads. Those were measured again on that build and have their own tables below. Everything else on this page is still 0.17.0's run.

The other rows were checked on the new build on 2026-11-22, with 0.18.1 run beside it: the median commit, the Cypher lookups, the traversals and vector search at 100,000 came out level between the two builds. Two things moved. lattice_node_get_property took 0.24 us where 0.18.1 took 0.22, in each of three alternating runs. And a full-text index is smaller in a format-5 file: 31 MB and 141 MB for the two sizes below, where the table says 36 and 172, with search times unchanged.

That day's figures are not in the tables. The machine was in use, and both builds measured behind this page: by a few percent on the small workloads, and by 15 to 30% on traversal and vector search at 100,000, the two that do not fit the processor's cache. The builds agreed with each other, so the tables keep the quieter 0.17.0 run. To be sure it was the day and not the releases, 0.17.0 itself was run in rotation with 0.18.1 and the new build that afternoon: all three measured the same on those two workloads, about 9.0 us for two hops and 130 to 140 us for a vector search.

Writes

A commit here is everything from lattice_begin to the return of lattice_commit: the log record is written and fsynced, so the transaction survives a crash once the call returns. A node is lattice_node_create with a label and two properties (an integer and a short string).

Operationp50p99p99.9Throughput
Create one node, one commit44 us [44–45]70 us [61–74]1.4 ms [0.2–1.9]18,900/s [15,600–21,600]
Create one edge (100K nodes present), one commit44 us [42–46]67 us [58–78]1.1 ms [0.2–3.0]15,400/s [8,200–22,600]

20,000 commits per run. About one commit in a few hundred also runs an automatic checkpoint (every 1,000 log frames), writing the pages the log changed into the database file; those, and the disk's own occasional stalls, are the p99.9. The slowest single commit in a run ranged from 2 ms to over 200 ms, from run to run and in 0.16.0 as well, so it is not given as a figure; throughput, which is the mean, moves with it.

Batched: N nodes or edges per transaction, the rate counting every commit (the time to close the database is not included).

Transaction sizeNodes/sTime per transactionEdges/s (100K nodes)
10130,000 [117,000–144,000]63 us
100284,000 [274,000–295,000]0.28 ms
1,000332,000 [320,000–337,000]2.4 ms247,000 [245,000–248,000]
10,000351,000 [345,000–353,000]27 ms252,000 [244,000–254,000]

Format 5. The same two workloads on the build after 0.18.1, with 0.18.1 run beside it on the same day (2026-11-22, the machine in use):

Transaction sizeNodes/sTime per transaction0.18.1Edges/s (100K nodes)0.18.1
1,000408,000 [386,000–420,000]2.1 ms319,000320,000 [314,000–325,000]219,000
10,000416,000 [409,000–425,000]21 ms338,000372,000 [359,000–376,000]220,000

Nodes are a quarter faster because a new id now goes to the right edge of the node tree instead of a different page each time (Id Key Order). Relationships gain more, and more the larger the transaction, because a commit that creates 64 or more of them sorts their tree entries and inserts them in order (Bulk loading). 0.18.1's figures that day are 4 to 13% below the 0.17.0 rows above, so read the new rows as a little low too. Transactions of 10 and 100 rows are not in this table: an fsync per transaction decides them, the disk stalled often that day, and the two builds' runs overlapped.

Other settings

These rows change one setting from the defaults, and are labelled so.

OperationSettingp50p99Throughput
Create one node, one commitsync_mode = normal6.4 us [6.3–6.5]14 us [14–15]102,000/s [86,000–116,000]
Nodes in transactions of 1,000sync_mode = normal339,000/s [328,000–341,000]

normal hands each commit to the operating system without waiting for the disk: it survives the process being killed, and a power cut can lose the last commits (see Durability). Once a transaction holds a thousand rows the fsync no longer shows. (On the format-5 build the second row measured 423,000/s [406,000–444,000] on 2026-11-22, beside 408,000/s with full.)

Bulk load

1,000,000 nodes, then 2,000,000 edges between random pairs of them, then close (three runs).

Format 5, the build after 0.18.1, measured 2026-11-20 on a quiet machine:

SettingsRows per transactionTotalNodesEdgesFilePeak memory
Defaults10,00023.4 s [22.4–23.5]2.3 s20.9 s451 MB130 MB
Defaults100,00011.3 s [11.1–11.8]2.7 s8.6 s461 MB190 MB
Defaults1,000,0008.7 s [8.7–9.0]2.7 s6.1 s458 MB680 MB
No log, changefeed off, 1 GB cache (the bulk-load recipe)10,0006.4 s [6.3–6.5]0.8 s5.2 s315 MB1.1 GB

Before format 5, in transactions of 10,000 (0.17.0; 0.18.1 took 35.9 s and 8.2 s for these two rows on 2026-11-20):

SettingsTotalNodesEdgesFilePeak memory
Defaults34.4 s [34.3–35.0]3.5 s30.9 s500 MB175 MB
No log, changefeed off, 1 GB cache7.9 s [7.8–8.0]1.1 s6.3 s364 MB1.1 GB

The recipe gives up crash safety for the load (an interrupted load is started again from its source) and the changefeed's record of it; the file is smaller because the changefeed holds no events.

Before format 5 the size of the transaction made almost no difference to a load: 0.18.1 took 35.9 s at 10,000 rows and 33.6 s at 100,000. Now it is the first thing to change, and Bulk loading has the full table, with what each setting writes to disk.

The format-5 rows are from the branch before it was merged. They were run again on the merged commit on 2026-11-22, with the machine in use: every configuration wrote the same amount to disk and the same size of file as on the 20th, and took 6 to 18% longer, as 0.18.1 did beside it.

Point lookups

100,000 nodes, each with an indexed integer uid. The database was written, closed and reopened, and every node read once before timing, so the pages are in the cache: these are warm reads. Uniformly random nodes.

Operationp50p99
lattice_node_get_property inside an open read transaction0.22 us0.24 us
Begin a read transaction, read one property, commit0.34 us0.36 us
Cypher MATCH (n:Person {uid: $uid}) RETURN n.name (prepared once)2.3 us2.5 us
The same, prepared and freed on every call2.4 us2.7 us
Cypher MATCH (n) WHERE id(n) = $id RETURN n.name (prepared once)1.1 us1.3 us

A Cypher row is what a binding's query call does: bind the parameter, begin a read transaction, execute, read every row, free the result, commit. The two property-read rows are timed 100 and 10 calls at a time, so their percentiles are of those groups' means. Run-to-run ranges were within 5% for every row.

Graph traversal

A graph of Person nodes with 5 outgoing KNOWS edges each to uniformly random other nodes. Each query starts at a random node found through the uid index and returns a count; the prepared query runs as in the lookups above. "Paths" is the mean count returned, which is the work the query did.

Query10K nodes, 50K edges: p50p99100K nodes, 500K edges: p50p99Paths
(a {uid: $uid})-[:KNOWS]->(b) RETURN count(b)2.5 us5.4 us4.8 us7.2 us5
two hops, count(c)4.4 us6.6 us8.8 us12 us25
two hops, count(DISTINCT c)5.3 us5.7 us6.7 us7.3 us25
three hops, count(d)14 us16 us21 us30 us125
-[:KNOWS*1..5]->(b) RETURN count(b)472 us499 us600 us661 us3,904
lattice_edge_get_outgoing (C API, read transaction included)0.63 us0.75 us0.75 us1.0 us5

A variable-length pattern enumerates paths, one at a time, so its cost follows the number of paths (here 5 + 25 + 125 + 625 + 3,125), not the number of nodes reached: about 0.12 to 0.15 us per path. See Variable-Length Paths.

Documents of 50 words drawn from a 5,000-word vocabulary with a Zipf distribution (a few words very common, most rare), indexed by a declared full-text index on Doc.text as they were written (transactions of 1,000). Searches ask lattice_fts_search for the top 10 by BM25, with query words chosen uniformly among the 20th to the 2,000th most frequent, so a query word appears in between about 0.3% and 27% of the documents.

10,000 documents100,000 documents
One word: p50 / p998.5 us / 103 us104 us / 1.2 ms
Two words (both required): p50 / p999.0 us / 70 us78 us / 0.70 ms
Indexing rate29,800 docs/s28,200 docs/s
File size36 MB172 MB

Ranking reads every posting of the query's words, so a search costs in proportion to how many documents contain them: the p99 is the common words, which at 100,000 documents match tens of thousands. The file holds the text, the index (with word positions, for phrase queries), and the changefeed's record of every write.

128-dimensional vectors, cosine distance, the default index (m 16, ef_construction 200, ef_search 64), top 10. The vectors are clustered (one centre per thousand vectors, at least ten, plus Gaussian noise of 0.1 per dimension, normalised); each query is a stored vector plus noise of 0.05 per dimension. Recall@10 is against an exact search over 200 queries. Vectors were inserted with lattice_batch_insert, 1,000 per transaction; the searches ran in a fresh process after reopening, 1,000 timed searches after 100 warm-up ones (three runs per scale, one at 1M).

VectorsInsert rateSearch p50p99Recall@10FileMemory
1,0003,800/s35 us42 us100%1.2 MB3 MB
10,0002,800/s66 us73 us98.6%11 MB13 MB
100,0001,830/s122 us192 us98.3%108 MB108 MB
1,000,000224/s1.34 ms3.1 ms95.6%1,074 MB185 MB

"Memory" is what opening the database and running the searches added to the process's footprint (the figure Activity Monitor shows). It follows the file until the file outgrows the 100 MB page cache, which bounds it. Run-to-run ranges were within 5% at 1K to 100K; the 1M row is one run.

The default cache is the limit at a million vectors. Once the file outgrows the 100 MB cache (at about 100,000 vectors), searches read pages back from the operating system and inserts slow down steeply: building 250,000 vectors, the rate fell from 1,500/s over the first 90,000 to 400/s by 230,000, where with a 2 GB cache it held at about 1,450/s throughout. With the cache sized to the file (one run each):

VectorsCacheBuildInsert rateSearch p50p99Recall@10Memory
250,000100 MB (default)6.0 min693/s
250,0002 GB2.9 min1,425/s
1,000,000100 MB (default)75 min224/s1.34 ms3.1 ms95.6%185 MB
1,000,0002 GB, searching the default build0.21 ms0.46 ms95.6%1.1 GB
1,000,0002 GB, built and searched17.7 min939/s0.22 ms0.58 ms92.6%1.1 GB

The two 1M builds hold the same vectors but are different graphs (an HNSW node's level is random), and their recall at the default ef_search differs by three points: at this scale, treat recall@10 at ef_search 64 as about 93–96% on this data, and use 128 where the last points matter. Opening the 1M database took 4.0 s with the default cache and 1.2 s with the larger one.

Mean latency and recall@10 for other ef_search values (lattice_vector_search's argument; 0 means the default, 64).

ef_search10,000: meanrecall100,000: meanrecall1,000,000: meanrecall
1628 us92.0%55 us90.7%0.71 ms72.5%
3244 us97.0%86 us96.3%1.05 ms87.7%
64 (default)67 us98.6%123 us98.3%1.54 ms95.6%
128100 us98.9%180 us98.5%2.0 ms98.4%
256154 us98.9%266 us98.5%2.5 ms98.5%

The 1M column is with the default 100 MB cache. Recall stops rising at about 98.5–99% on this data: past ef_search 128, a larger search list finds nothing more.

Developer benchmarks

zig build benchmark, vector-benchmark, graph-benchmark, sqlite-benchmark, storage-benchmark and fts-benchmark remain for working on the engine. They call internal Zig paths directly, some with the log off, the graph ones over an in-memory adjacency cache that queries, the C API and the bindings never read, and the vector one against the HNSW index without the database around it. Their figures are not comparable to the tables on this page and are not published.

Earlier versions of this page quoted those programs (a 0.13 us node lookup, a 0.65 us node creation, 0.83 ms vector search at 1M, an optimisation history of the vector index). Those were measured on an Apple M1, on older releases, by that method; they are withdrawn rather than carried forward.

Reproducing

From the repository root, on an idle machine (Python 3 and the system SQLite are needed; nothing else):

zig build capi-benchmark                         # every table above but the 1M rows (~15 min)
zig build capi-benchmark -- --suite vector-1m    # the 1M-vector row (~80 min; a 1 GB file, then a 2 GB cache)
zig build capi-benchmark -- --suite vector-cache # the 250K builds and the 1M build with a 2 GB cache (~30 min)
zig build capi-benchmark -- --list               # what each suite runs
zig build capi-benchmark -- --suite core --json now.json   # keep every run's numbers

Each row prints its median and range; --json keeps every run. One workload can be run by hand, for example zig-out/bin/capi-bench commit_node --db /tmp/x.db --ops 5000; it prints one RESULT line. The bulk-load rows with 100,000 and 1,000,000 rows per transaction were run that way, since the suite loads in transactions of 10,000: zig-out/bin/capi-bench bulk --db /tmp/x.db --n 1000000 --degree 2 --batch 100000.

To compare two versions with the same program, build it against the other checkout and compare the saved runs:

python3 tests/benchmark/capi_bench.py build-against ../latticedb-0.16.0 --out /tmp/cb-0160
python3 tests/benchmark/capi_bench.py --bin /tmp/cb-0160 --suite core --json old.json
zig build capi-benchmark -- --suite core --json new.json
python3 tests/benchmark/capi_bench.py compare old.json new.json