Optimize wa-sqlite binary RPC reads#159
Merged
Merged
Conversation
6acca00 to
2ed710b
Compare
Antonov548
approved these changes
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tree.parentandtree.getPayloadworker RPC results asUint8Arrayinstead of number arraysappendManycalls at RPC boundaries so a single large sync/import batch does not monopolize the worker queueWhy
The stall shape we care about is a read getting stuck behind a large write batch in the worker. The test now runs one large append by default, then reports child-read and payload-read p50/p95/max during that write.
Local single-run comparison against
origin/mainwith one 5k-op append:The PR still keeps write throughput in the same rough range; the goal is to avoid second-scale read stalls, not to add a fragile microbenchmark threshold.
Testing
node packages/treecrdt-wa-sqlite/scripts/copy-opfs-vfs.mjs --sources-only && ./node_modules/.bin/tsc -p packages/treecrdt-wa-sqlite/tsconfig.json./node_modules/.bin/prettier --check packages/treecrdt-wa-sqlite/src/client.ts packages/treecrdt-wa-sqlite/e2e/tests/responsiveness.spec.ts packages/treecrdt-wa-sqlite/src/rpc.ts packages/treecrdt-wa-sqlite/src/common-worker.ts packages/treecrdt-wa-sqlite/src/worker.ts packages/treecrdt-wa-sqlite/src/shared-worker.ts packages/treecrdt-wa-sqlite/e2e/src/responsiveness.tsgit diff --check./node_modules/.bin/playwright test tests/responsiveness.spec.ts --project chromium-dev --reporter=linefrompackages/treecrdt-wa-sqlite/e2eusing a local temporary pnpm shim because this shell has no pnpm binary