reference

Recorded benchmark runs, newest first. Each entry gives the date, the commit, the machine (CPU, RAM, OS, storage), the command, and the table produced by sophia-bench-report. A note follows each entry with what the numbers mean for the hypotheses of the Benchmark Plan: confirmed, refuted, or unclear.

2026-11-18: B-014, the set-oriented native executor (B-17 re-run)

  • Machine: AMD Ryzen 7 7800X3D, 8 threads, 30 GiB RAM, Linux 7.3.4-arch1-2.
  • Commit: B-014 on dev-danielb (before: 88837d1, the same machine and day).
  • Commands: cargo run --release -p sophia-bench --bin sophia-bench-report -- --sizes 1000 --query-size 10000 --only-queries, and … --query-size 100000 --backends sqlite,redb,lmdb --only-queries with the binary built before and after. Raw output: meta/scratchpad/b014/.
  • What changed (eval): a prefix access path for name(p, _) with a bound startswith; anti-joins for negated base literals after 256 probes; borrowed term reads, a binding trail and grouping as solutions arrive; SQLite’s all_refs and all_kinds reading digests in place.
  • “Native, tuple at a time” is the new executor with the prefix path and anti-joins switched off (Tuning::TUPLE_AT_A_TIME), in the same run. It keeps the borrowed reads, so “before” is the old binary.
  • The recursive workloads are unchanged within noise (10⁵ SQLite: transitive dependants 0.648 → 0.644 ms, dependencies 7.63 → 7.38 ms), as are the row counts of every workload.

At 100 000 definitions (median ms)

backendworkloadbeforeafterafter, tuple at a timeSQL (SQLite)
sqlitecount by kind112.576.376.251.6
sqliteunreferenced definitions320.0142.2295.532.3
sqlitenames by prefix40.40.16235.94.84
redbcount by kind70.136.836.3
redbunreferenced definitions172.8126.0161.1
redbnames by prefix42.60.11938.0
lmdbcount by kind57.029.929.9
lmdbunreferenced definitions108.999.0100.4
lmdbnames by prefix38.80.08030.6

At 10 000 definitions (median ms)

backendworkloadbeforeafterafter, tuple at a timeSQL (SQLite)
sqlitecount by kind10.337.136.674.43
sqliteunreferenced definitions20.4511.8619.282.73
sqlitenames by prefix3.630.0993.260.441
redbcount by kind5.813.253.25
redbunreferenced definitions14.019.7013.38
redbnames by prefix3.710.0683.32
lmdbcount by kind5.152.732.70
lmdbunreferenced definitions8.797.368.30
lmdbnames by prefix3.160.0602.76
duckdbcount by kind7.60 (2026-10-20)4.844.29
duckdbunreferenced definitions1982 (2026-10-20)73.42011
duckdbnames by prefix6.37 (2026-10-20)1.375.92

What this says

  • The prefix path is a range read: 0.06–0.16 ms against 30–43 ms, flat in the store’s size. That is faster than SQLite’s own engine on the translated SQL (4.8 ms at 10⁵), whose substr(p, 1, length(s)) = s filter (sql.rs) cannot use the name index.
  • Anti-joins halve the negation on SQLite (320 → 142 ms) and save 27× on DuckDB, whose point lookups cost about 0.3 ms. On LMDB, where a lookup costs about 1 µs, the scan and the probes cost about the same.
  • Count by kind is 30–48 % faster from the borrowed reads and the grouping alone.
  • Native still trails SQL on SQLite by 1.5× (count) and 4.4× (negation). Timing the parts at 10⁴ (a probe example, removed after): all_kinds takes 5.0 ms of the 7 ms, because t_definition is a rowid table and its kind index does not hold id, so the scan reads every whole row. A covering index on (kind, id) would remove most of that; it is a storage change and waits for Daniel (SR-126). The rest is the executor’s tuple vectors (Vec<Val> per base tuple).

2026-10-20 (late night): B-15, Moonkale’s edit loop through Sophia

The first end-to-end measurement with Moonkale. Moonkale (26752448, on Sophia 202e137a) times its own edit path through the Source trait: resolve and fetch a definition, save an edited text with apply, read the name’s new id, list the definitions that still reference the old id. Script: experiments/b15-edit-loop/run.sh (run); 200 runs per store, each alternating the original and the edited text; release build; this machine (see the B-16 section for hardware).

StoreEdited definitionDependantsfetchsavenew iddependantswhole loop p50p90p99
SPEC-004 sample (in memory)sample.add150 µs186 µs17 µs17 µs0.27 ms0.35 ms1.0 ms
1 000 synthetic8.8 KB of text222.0 ms3.4 ms31 µs164 µs5.6 ms6.1 ms7.0 ms
10 000 synthetic52 B11971 µs324 µs35 µs969 µs1.4 ms1.7 ms3.5 ms
100 000 synthetic (3 runs, file pre-read)71 B8564 µs310–331 µs29 µs0.96–1.05 ms1.3 ms1.5–1.6 ms2.4–3.5 ms

Step columns are medians. The target, < 50 ms p99 for one definition on a 10⁵ store, is met by more than an order of magnitude.

Cold first save (the only slow one):

  • on a store file already in the OS page cache: first save 8–19 ms, first dependants query 2.2–2.6 ms (whole first loop 11–22 ms);
  • on a freshly copied file (btrfs: a copy starts with a cold page cache): up to 0.65 s for the save and 0.2–1.5 s for the dependants, all of it waiting for the disk. Sophia’s Interface called directly (crates/sophia-interface/examples/edit_timing.rs) shows the same pattern: 208 ms on a cold file, 2 ms once the file has been read. So the cold cost is the operating system’s, not Sophia’s or Moonkale’s adapter.

What this says.

  • Store size does not matter between 10⁴ and 10⁵ definitions; what grows the loop is the edited definition’s text length (fetch and save parse, elaborate, normalise and print it: 8.8 KB takes 5 ms) and its number of dependants (about 10 µs each to list).
  • Moonkale’s adapter adds little: its steps are within a few µs to tens of µs of the direct Interface calls.
  • The user-visible latency is dominated by something else: Moonkale’s change feed polls every 500 ms. Edits take a millisecond, so the feed should push (SR-37 allows a push subscription), or poll much faster when idle costs allow.
  • Not measured: the workspace’s re-fetch after save, the change-feed path, and paint (needs Daniel’s desktop), as the Moonkale agent listed.

2026-10-20 (night): B-16 on a real library, Metamath set.mm

  • Machine: as below.
  • Command: sophia-bench-report --sizes 1000 --backends sqlite,redb,lmdb --metamath ~/.cache/sophia-corpora/set.mm/set.mm --skip-queries --only-queries.
backendassertionsproofsrecordsparseingest (parse + store)sizequeries (median of 5)
sqlite5115948083981362.25s15.26s564 MiBaxioms behind 2p2e4: 15 rows, 3.87 ms; axioms behind fta (fundamental thm of algebra): 46 rows, 79.34 ms; proofs using ax-mp directly: 5361 rows, 14.53 ms; count by kind: 3 rows, 97.06 ms
redb5115948083981362.17s10.91s1028 MiBaxioms behind 2p2e4: 15 rows, 2.42 ms; axioms behind fta (fundamental thm of algebra): 46 rows, 46.53 ms; proofs using ax-mp directly: 5361 rows, 13.53 ms; count by kind: 3 rows, 66.98 ms
lmdb5115948083981362.17s6.21s791 MiBaxioms behind 2p2e4: 15 rows, 1.85 ms; axioms behind fta (fundamental thm of algebra): 46 rows, 37.14 ms; proofs using ax-mp directly: 5361 rows, 10.04 ms; count by kind: 3 rows, 52.63 ms

Where the space goes (SQLite, set.mm)

TableMiBShare
definitions (canonical bytes, display, refs blob)23842 %
t_ref (reference edges)12522 %
t_ref_dst (the reverse index)11520 %
log285 %
everything else5911 %
  • Canonical bytes: 49 MiB of statements and 83 MiB of proofs.
  • 1.5 M reference edges.

What this says

  • Real queries are fast:
    • the axioms behind 2p2e4 take 1.9 ms on LMDB;
    • the axioms behind the fundamental theorem of algebra (46 of them, a deep chain) take 37 ms;
    • LMDB is fastest on every query, redb next, SQLite last but within about 2×.
  • Ingest: LMDB 6.2 s, redb 10.9 s, SQLite 15.3 s, of which 2.2 s is parsing.
  • Reference edges dominate storage on real code (SP-011 Reference edges dominate storage on real code): about 31 references per proof, against 3 in the synthetic generator. H3 is refuted on synthetic code and confirmed on real code. Synthetic benchmarks understated the cost of 32-byte references by about 10×. That is the reason for B-16.
  • What the library taught the design: Real Code Corpora §4.

2026-10-20 (evening): B-17, Sophia’s own query language (SPEC-007), and the zero-copy breakdown

  • Machine: AMD Ryzen 7 7800X3D, 8 threads, 30 GiB RAM, Linux 7.2.9-arch1-1.
  • Commit: the M3a commit (sophia-query).
  • Commands:
    • cargo run --release -p sophia-bench --bin sophia-bench-report -- --sizes 1000 --query-size 10000 --only-queries
    • … --query-size 100000 --zero-copy --skip-queries --only-queries
    • … --query-size 100000 --backends sqlite,redb,lmdb --only-queries (DuckDB left out at 10⁵: ingest takes about 17 minutes)
  • Workload: the synthetic corpus (seed 42). Per-probe workloads use 20 random probes, and report time and rows per probe.
  • “No magic sets” runs compute the whole relation whatever the probe, so they are timed once, on the first probe (its row count is that probe’s, not the average).
  • Native step limit: 50M join steps. SQL step limit: 50M SQLite VM steps. The two limits are not comparable.

B-17 at 10 000 definitions

backenddefinitionsworkloadexecutorrows (per probe)median
sqlite10000direct dependantsnative20.005 ms
sqlite10000direct dependantsSQL20.005 ms
sqlite10000transitive dependantsnative1010.171 ms
sqlite10000transitive dependantsnative, no magic sets (1 probe)06160.590 ms
sqlite10000transitive dependantsSQL1010.167 ms
sqlite10000transitive dependantsSQL, no magic sets (1 probe)0aborted at the step limit
sqlite10000transitive dependenciesnative4060.970 ms
sqlite10000transitive dependenciesnative, no magic sets (1 probe)6897358.344 ms
sqlite10000transitive dependenciesSQL4060.839 ms
sqlite10000transitive dependenciesSQL, no magic sets (1 probe)0aborted at the step limit
sqlite10000count by kindnative110.068 ms
sqlite10000count by kindSQL14.622 ms
sqlite10000unreferenced definitionsnative119.895 ms
sqlite10000unreferenced definitionsSQL12.742 ms
sqlite10000names by prefixnative1003.818 ms
sqlite10000names by prefixSQL1000.443 ms
redb10000direct dependantsnative20.002 ms
redb10000transitive dependantsnative1010.180 ms
redb10000transitive dependantsnative, no magic sets (1 probe)05945.146 ms
redb10000transitive dependenciesnative4061.219 ms
redb10000transitive dependenciesnative, no magic sets (1 probe)6897286.904 ms
redb10000count by kindnative15.438 ms
redb10000unreferenced definitionsnative113.600 ms
redb10000names by prefixnative1003.485 ms
lmdb10000direct dependantsnative20.002 ms
lmdb10000transitive dependantsnative1010.132 ms
lmdb10000transitive dependantsnative, no magic sets (1 probe)05954.229 ms
lmdb10000transitive dependenciesnative4060.995 ms
lmdb10000transitive dependenciesnative, no magic sets (1 probe)6897523.000 ms
lmdb10000count by kindnative14.794 ms
lmdb10000unreferenced definitionsnative18.254 ms
lmdb10000names by prefixnative1003.005 ms
duckdb10000direct dependantsnative20.336 ms
duckdb10000transitive dependantsnative10118.754 ms
duckdb10000transitive dependantsnative, no magic sets (1 probe)08273.397 ms
duckdb10000transitive dependenciesnative406146.489 ms
duckdb10000transitive dependenciesnative, no magic sets (1 probe)6899887.424 ms
duckdb10000count by kindnative17.601 ms
duckdb10000unreferenced definitionsnative11982.238 ms
duckdb10000names by prefixnative1006.366 ms

B-17 at 100 000 definitions (SQLite, redb, LMDB)

The first attempt at this size was stopped by hand: the non-magic closure grew past 14 GB before reaching the 50M-step limit. That is how the derived-tuple cap (5M by default) came about: the step budget alone does not bound memory. With the cap, the run stayed near 2 GB.

backenddefinitionsworkloadexecutorrows (per probe)median
sqlite100000direct dependantsnative20.004 ms
sqlite100000direct dependantsSQL20.006 ms
sqlite100000transitive dependantsnative2250.643 ms
sqlite100000transitive dependantsnative, no magic sets (1 probe)0aborted at the derived-tuple limit
sqlite100000transitive dependantsSQL2250.611 ms
sqlite100000transitive dependantsSQL, no magic sets (1 probe)0aborted at the step limit
sqlite100000transitive dependenciesnative20557.572 ms
sqlite100000transitive dependenciesnative, no magic sets (1 probe)0aborted at the derived-tuple limit
sqlite100000transitive dependenciesSQL20556.903 ms
sqlite100000transitive dependenciesSQL, no magic sets (1 probe)0aborted at the step limit
sqlite100000count by kindnative1105.918 ms
sqlite100000count by kindSQL157.352 ms
sqlite100000unreferenced definitionsnative1309.679 ms
sqlite100000unreferenced definitionsSQL132.478 ms
sqlite100000names by prefixnative10038.649 ms
sqlite100000names by prefixSQL1004.823 ms
redb100000direct dependantsnative20.002 ms
redb100000transitive dependantsnative2250.494 ms
redb100000transitive dependantsnative, no magic sets (1 probe)0aborted at the derived-tuple limit
redb100000transitive dependenciesnative20556.854 ms
redb100000transitive dependenciesnative, no magic sets (1 probe)0aborted at the derived-tuple limit
redb100000count by kindnative165.018 ms
redb100000unreferenced definitionsnative1167.503 ms
redb100000names by prefixnative10039.374 ms
lmdb100000direct dependantsnative20.001 ms
lmdb100000transitive dependantsnative2250.368 ms
lmdb100000transitive dependantsnative, no magic sets (1 probe)0aborted at the derived-tuple limit
lmdb100000transitive dependenciesnative20555.853 ms
lmdb100000transitive dependenciesnative, no magic sets (1 probe)0aborted at the derived-tuple limit
lmdb100000count by kindnative151.038 ms
lmdb100000unreferenced definitionsnative198.657 ms
lmdb100000names by prefixnative10031.189 ms

Zero-copy breakdown (LMDB, 100 000 definitions)

stepns per record
get, borrowed from the map (no copy)207
get + copy into a Vec620
get + walk the framing in place (no allocation)323
ReadTx::record (copy + decode the record)868
record + decode the core term (heap objects)11597

What this says

Magic sets are the first-order effect.

  • Without them, “transitive dependants of X” evaluates the closure of the whole store:
    • 6–8 s per query natively;
    • over the step limit in SQL.
  • With them, it takes 0.13–0.18 ms on SQLite, redb and LMDB. That is 4.5 orders of magnitude, far more than any backend difference.
  • The rewrite is an IR → IR transformation, so the SQL translation benefits identically (0.167 ms).

At 10⁵ the shape holds. With magic sets, transitive dependants take:

  • 0.37 ms on LMDB;
  • 0.49 ms on redb;
  • 0.64 ms on SQLite natively, and 0.61 ms as SQL.

Without magic sets, every executor stops at its limit. Native count-by-kind and negation scale linearly (LMDB: 51 ms and 99 ms; SQLite SQL: 57 ms and 32 ms).

Backend independence costs little on recursive queries.

  • On SQLite, the native executor and SQLite’s own engine running the translated SQL are equal: 0.171 against 0.167 ms for transitive dependants, 0.97 against 0.84 ms for dependencies.
  • LMDB is the fastest native backend (0.132 ms). It has no query language of its own, so this is exactly the case S-ADR-0011 was for.

Set-at-a-time workloads favour SQL by 2–9× on SQLite:

WorkloadNativeSQL
count by kind10.1 ms4.6 ms
unreferenced definitions19.9 ms2.7 ms
names by prefix3.8 ms0.44 ms

The native executor works tuple at a time:

  • with Val allocations per tuple;
  • one dependants lookup per definition for the negation;
  • a full name scan where a prefix range scan would do.

These are known, fixable costs (SPEC-007 §11):

  • a prefix access path;
  • set-at-a-time anti-joins for negation over a scanned relation;
  • borrowed field reads.

LMDB natively is already within 2× of SQLite’s SQL on count by kind.

DuckDB runs the native executor correctly but slowly on point lookups (about 0.3 ms each): 18.8 ms for transitive dependants, 2 s for the negation. It was 1.9 s for count by kind before its set-at-a-time access paths (all_kinds, all_refs) were added, and 7.6 ms after. Confirms S-ADR-0010: DuckDB is for analytics, not a primary.

Zero-copy (SR-101): see Zero-Copy Storage of Canonical Graphs.

  • Borrowed LMDB reads cost 0.21 µs; the store’s copy-and-decode costs 0.87 µs.
  • Decoding the core term into heap objects costs 11.6 µs.
  • The database is not where time is lost. Heap term construction is.

2026-10-20 (later): four backends (SQLite, redb, LMDB, DuckDB)

  • Machine and workload: as below (Ryzen 7 7800X3D, synthetic corpus, seed 42, batches of 1000).
  • Commands:
    • cargo run --release -p sophia-bench --bin sophia-bench-report -- --sizes 1000,10000
    • … -- --sizes 100000 --backends sqlite,redb,lmdb --skip-analytics
    • … -- --sizes 10000 --backends sqlite,duckdb --analytics-size 10000
  • All four backends pass the conformance suite (store: 66 tests; interface acceptance: 29 tests across the backends).

B-03 / B-04 / B-05

backenddefinitionsingestingest ratesize on diskbytes / defrecord by idnamedependantsclosure of last (size)full change feed
sqlite10000.06 s17772 defs/s6.6 MiB68891.9 µs0.5 µs0.7 µs0.28 ms (128)0.6 ms
redb10000.05 s20273 defs/s16.1 MiB168471.0 µs0.4 µs0.7 µs0.14 ms (128)0.5 ms
lmdb10000.03 s29245 defs/s7.5 MiB78890.7 µs0.2 µs0.3 µs0.10 ms (128)0.5 ms
duckdb10009.82 s102 defs/s9.5 MiB9974190.2 µs141.8 µs196.2 µs24.6 ms (128)1.6 ms
sqlite100000.72 s13916 defs/s64.6 MiB67763.2 µs0.6 µs0.9 µs2.9 ms (901)5.9 ms
redb100000.60 s16573 defs/s128.5 MiB134751.2 µs0.5 µs0.9 µs1.2 ms (901)6.1 ms
lmdb100000.38 s26425 defs/s95.4 MiB100090.7 µs0.2 µs0.4 µs0.74 ms (901)5.0 ms
duckdb1000091.55 s109 defs/s132.0 MiB13842203.5 µs153.2 µs206.8 µs182.7 ms (901)11.7 ms
sqlite10000012.97 s7709 defs/s646.5 MiB67794.9 µs1.3 µs2.5 µs26.9 ms (5713)74.9 ms
redb1000009.72 s10289 defs/s1028.0 MiB107791.3 µs0.6 µs1.5 µs9.2 ms (5713)91.0 ms
lmdb1000005.67 s17648 defs/s816.8 MiB85650.9 µs0.3 µs0.7 µs8.0 ms (5713)67.6 ms

DuckDB was not run at 10⁵: at about 100 definitions/s, ingest would take about 15 minutes, and the 10³ and 10⁴ rows already show its scaling.

B-11: analytical queries (10 000 definitions)

querySQLiteDuckDB
count by kind0.29 ms2.11 ms
10 most referenced (a join and a group)11.80 ms4.16 ms
mean size per status (reads every blob’s length)89.66 ms4.17 ms

What this says

  • LMDB is the fastest at everything Moonkale does per keystroke:
    • ingest is 1.7–2.3× SQLite’s;
    • record lookup is 4–5× faster;
    • closure walks are 3–4× faster;
    • its size is between SQLite’s and redb’s.
  • SQLite is the smallest, queryable, and already in Moonkale.
  • redb is fast and needs no C toolchain, but has the largest files (no compaction run here; Redb::compact now exists for a fair re-measurement).
  • DuckDB is unsuitable as the primary store. Each edit is a small transaction, and on that workload it is about 100× slower at reads and about 150× slower at ingest. On analytics it wins clearly (3–20× on joins and scans), apart from a trivial count. Its place is an analytics replica, fed in bulk (the Appender API, not row inserts) for the precompilation statistics of SR-66. Per-row ingest is DuckDB’s worst case and is not a fair test of bulk loading.
  • H2 still holds: normalising and hashing are not the bottleneck at these rates.

2026-10-20: first store benchmarks (synthetic code)

  • Commit: the commit that adds this page; the code is the M0/M1 implementation.
  • Machine: AMD Ryzen 7 7800X3D (8 cores), 30 GiB RAM, Linux 7.2.9 (Arch), NVMe SSD. Release build, nothing else running.
  • Command: SOPHIA_BENCH_DATE=2026-10-20 cargo run --release -p sophia-bench --bin sophia-bench-report -- --sizes 1000,10000,100000
  • Workload: synthetic sophialang from sophia_bench::generate, seed 42. Term nodes per definition are log-normal (median 60, σ 0.9); references are Poisson (mean 3); 1 % of definitions are in recursive pairs. Ingest is in batches of 1000, with a name for each definition. Lookups are 1000 random probes, median of 5 runs, reported per lookup.

B-07 / B-05: canonical sizes (10 000 synthetic definitions)

median bytesp90 bytesmean bytesdistinct refs per defreference digests in canonical byteskey overhead (32 B / mean)savings with 8-byte local ids
2588857338162.992.5 % of bytes0.8 %1.9 % of bytes

B-03 / B-04 / B-05: backends (after the SQLite fix described below)

backenddefinitionsingestingest ratesize on diskbytes / defrecord by idnamedependantsclosure of last (size)full change feed
sqlite10000.06 s17140 defs/s6.6 MiB68891.9 µs0.5 µs0.7 µs0.28 ms (128)0.6 ms
redb10000.05 s20854 defs/s16.1 MiB168470.9 µs0.4 µs0.7 µs0.13 ms (128)0.6 ms
sqlite100000.68 s14680 defs/s64.6 MiB67763.2 µs0.6 µs0.9 µs2.7 ms (901)5.8 ms
redb100000.57 s17650 defs/s128.5 MiB134751.2 µs0.5 µs0.8 µs1.2 ms (901)5.7 ms
sqlite10000010.90 s9177 defs/s646.5 MiB67794.5 µs1.3 µs2.2 µs22.8 ms (5713)70.9 ms
redb1000008.05 s12423 defs/s1028.0 MiB107791.4 µs0.6 µs1.4 µs7.5 ms (5713)73.8 ms

Before the fix, with SQLite t_definition declared WITHOUT ROWID and three queries per record, SQLite at 100 000 definitions measured:

  • record by id: 18.5 µs;
  • closure: 107 ms;
  • ingest: 6821 definitions/s;
  • 7781 bytes per definition.

See sqlite for the cause.

What this says

  • H2 (hashing is irrelevant next to everything else): consistent. Ingest, which normalises, hashes and writes, runs at 9 000–21 000 definitions/s, i.e. 50–110 µs per definition including the database write. B-01 and B-02 (criterion) will separate hashing from writing.

  • H3 (local ids save ≥ 30 %): refuted on this corpus. Reference digests are only 2.5 % of canonical bytes, and local ids would save 1.9 %. The reason is that the framing dominates: about 40 bytes per term node, because each tag-length-value field carries 8 bytes of lengths plus its tag, and built-in references (Nominal) are 32 bytes each. Block Size §2 assumed 8–16 bytes per node. The lever that matters is therefore B-06 (a compact storage encoding), not local ids. Caveat: synthetic definitions are large (median 2.6 KB), and real code may have more references per byte.

  • H1 (median definition 200 B – 4 KiB): the synthetic median of 2.6 KB lies inside the range, but that only says what the generator assumed. Real code is still needed.

  • Backends:

    • redb reads 2–3× faster (by id, closure) and ingests 20–35 % faster;
    • SQLite uses 35–60 % less disk, has SQL views, and is what Moonkale already ships;
    • name and dependants lookups are similar;
    • the change feed costs the same (~0.7 µs per entry).

    This does not yet decide anything: DuckDB and LMDB are still to come (M2), and redb’s file size has to be re-measured after compact().

  • Scaling: lookups grow slowly with size (B-tree depth plus the cache). Closure walks are linear in the closure’s size. At 10⁵ definitions, every backend answers point queries in a few microseconds, which is fast enough for an interactive editor by two orders of magnitude.