oficina / docs Public

Docs native: document the engine benchmark and the update wire gate

Also moves the September replica probe to the new CRDTReplica API
(command returns the update; projections through projection()).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 3070a2a0430aed8e2427e96e6329bddefc11b3aa parent e8f52ce
3 files changed, +23 −6
  • native/BUILDING.md +5 −3
  • native/benchmarks/NativePerformanceProbeTests.swift +4 −3
  • native/benchmarks/README.md +14 −0
diff --git a/native/BUILDING.md b/native/BUILDING.md
index b326550..bc6c1b3 100644
--- a/native/BUILDING.md
+++ b/native/BUILDING.md
@@ -18,9 +18,11 @@ It builds the CRDT WASM, runs Rust editor and bounded-host tests (including
opening and typing in a generated 200-page edited document on the host's
production fuel budget; see `fuel_budget` in `host/src/lib.rs`), checks native
and browser updates in both directions (including every list-rule reversal delta
-and its authoritative snapshot, and the undo-kept garbage-collection repro of
-discussion #145, whose collected units must match Yjs's), prepares the Apple XCFramework, and
-runs Swift adapter/actor tests. `--core-only` runs the Rust and wire checks on
+and its authoritative snapshot, the undo-kept garbage-collection repro of
+discussion #145, whose collected units must match Yjs's, and that each command's
+update carries only its own change, as the browser's per-transaction updates
+do), prepares the Apple XCFramework, and runs Swift adapter/actor tests.
+`--core-only` runs the Rust and wire checks on
Linux. CI invokes this through `.amadan/ci.d/20-native`, alongside the existing
server/web gate. `--mutations` additionally proves representative faulty changes
are caught, restoring every changed source and saving logs under
diff --git a/native/benchmarks/NativePerformanceProbeTests.swift b/native/benchmarks/NativePerformanceProbeTests.swift
index ccbc043..6ea5d81 100644
--- a/native/benchmarks/NativePerformanceProbeTests.swift
+++ b/native/benchmarks/NativePerformanceProbeTests.swift
@@ -18,7 +18,7 @@ final class NativePerformanceProbeTests: XCTestCase {
var inserted = 0
while inserted < limit {
let count = min(batchSize, limit - inserted)
- let (update, _) = try await replica.command(["op": .string("display_edit"), "generation": .number(Double(generation)), "at": .number(Double(inserted)), "length": .number(0), "text": .string(String(repeating: "a", count: count))])
+ let update = try await replica.command(["op": .string("display_edit"), "generation": .number(Double(generation)), "at": .number(Double(inserted)), "length": .number(0), "text": .string(String(repeating: "a", count: count))])
totalBytes += update.count; maximumBytes = max(maximumBytes, update.count)
inserted += count
await replica.retainGenerations([generation])
@@ -28,8 +28,9 @@ final class NativePerformanceProbeTests: XCTestCase {
}
if [100, 1000, 5000].contains(inserted) {
let elapsed = begin.duration(to: clock.now)
- let (snapshot, projection) = try await replica.command(["op": .string("snapshot")])
- let (clientsData, _) = try await replica.command(["op": .string("clients")])
+ let snapshot = try await replica.command(["op": .string("snapshot")])
+ let projection = try await replica.projection()
+ let clientsData = try await replica.command(["op": .string("clients")])
let clients = try JSONDecoder().decode([UInt64].self, from: clientsData)
XCTAssertEqual(projection.children.map(\.plainText).joined().count, inserted)
print("PROBE mode=\(mode) count=\(inserted) elapsed=\(elapsed) snapshot=\(snapshot.count) updateTotal=\(totalBytes) updateMax=\(maximumBytes) clients=\(clients.count)")
diff --git a/native/benchmarks/README.md b/native/benchmarks/README.md
index 4d04c0b..5815eb8 100644
--- a/native/benchmarks/README.md
+++ b/native/benchmarks/README.md
@@ -99,3 +99,17 @@ run's cumulative milestones, not selected best timings. Direct log:
`/private/tmp/docs-probe-reuse5000.log`. Repeat using `DOCS_PROBE_MODE=reuse`.
Followup executable SHA-256:
`b08998210ac83bec46a8cb2d62c51c0e2792b0c65e647f52fa58eaee879a3c55`.
+
+## Engine cost per keystroke (2026-11-22, `perf/native-realtime-engine`)
+
+`host/examples/realtime.rs` prices, through the production interpreter and
+fuel, what `CRDTReplica` does per typed character: `display_edit` on the
+displayed source, the update applied to the authority, the selection's two
+anchors resolved, and the authority's presentation (`project_delta`).
+Documents come from `fixtures/generate-large-doc.mjs` (see
+`docs-realtime-audit` in `oficina/native-levelup`).
+
+```sh
+cd native && cargo build --manifest-path crdt/Cargo.toml --release --target wasm32-unknown-unknown --lib --locked
+cargo run --release --manifest-path host/Cargo.toml --example realtime -- /tmp/rt-audit/docs/p*.bin
+```