Skip to content

Kora.js performance baseline

Targets from CLAUDE.md (repo root) with a 10% CI regression buffer (REGRESSION_FACTOR = 1.1). Gates run on every PR via benchmark-gates.yml.

Run locally

bash
pnpm benchmark:gates

Note: Store benchmark files are excluded from pnpm test (they run via pnpm --filter @korajs/store test:benchmarks inside benchmark:gates) so dev machines are not blocked by insert timing while the full suite runs in parallel.

Store (@korajs/store)

GateTargetCI limit (×1.1)Test file
Insert 10,000 records< 2s2,200 msperformance-gates.test.ts (better-sqlite3)
Insert 10,000 records (WASM path)< 2s2,200 mssqlite-wasm-performance-gates.test.ts
Query 1,000 rows (WHERE)< 50 ms55 msperformance-gates.test.ts, sqlite-wasm-performance-gates.test.ts
Reactive notification< 16 ms (1 frame)17.6 msperformance-gates.test.ts
Subscription bloom check (5000 subs)< 1 ms2 ms (dev/CI slack)subscription-manager.test.ts
IndexedDB 1,000 inserts (1 txn)< 10s11,000 msindexeddb-performance-gates.test.ts

WASM / OPFS note: CI exercises SqliteWasmAdapter + MockWorkerBridge (in-process SQLite). Real browser OPFS + worker latency is higher; record manual numbers when profiling templates (Chrome Performance, kora doctor).

Merge (@korajs/merge)

GateTargetTest file
Merge 1,000 concurrent field ops< 500 mspackages/merge/src/benchmarks/performance-gates.test.ts
LWW comparison< 1 µssame

Sync (@korajs/sync)

GateTargetCI limit (×1.1)Test file
Initial sync 10,000 ops (mock store)Completes38,500 msperformance-gates.test.ts
Incremental sync 1 op< 200 ms220 mssame
Version-vector delta (100 nodes)< 10 ms11 mssame

Production target: initial sync of 10,000 operations end-to-end in < 5s with real Store + SQLite (CLAUDE.md). The CI gate uses in-memory mock stores and validates completion under a relaxed ceiling.

Recording a new baseline

  1. Run pnpm benchmark:gates on main after a clean pnpm build.
  2. If a gate is consistently faster than the limit, tighten the constant in the test file (do not exceed 10% regression vs the recorded number).
  3. Update this table and the plan checklist item 0.1.6.

Multi-tab storage

Leader election + BroadcastChannel RPC is covered by packages/store/tests/integration/multi-tab-storage.test.ts. SharedWorker (single worker per origin) remains a stretch goal; see isSharedWorkerStorageSupported() in @korajs/store multi-tab module.