perf: drain SQLite operations through a native FIFO - #369
Open
chrispader wants to merge 6 commits into
Open
chrispader wants to merge 6 commits into
chrispader wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
chrispader
marked this pull request as ready for review
September 18, 2026 19:48
This branch was successfully deployed
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.
On a single open database, each async query used to wait for its predecessor's result to return through JavaScript before submitting native work. Batches and file imports had the same gap, and
setImmediatedelayed each handoff. This PR submits async queries, batches, and file imports directly to a native FIFO on the connection while retaining the JavaScript queue for transaction callbacks and lifecycle guards.One native worker drains each connection's jobs in submission order. A batch or file import remains one atomic native job. The JavaScript queue waits for earlier jobs before starting a transaction callback and holds later jobs until it commits or rolls back. Synchronous transaction methods reject while
tx.executeAsyncis pending; if the callback exits with pending queries, it waits for them and rolls back. An exception while settling one native promise no longer strands later jobs. Synchronous operations and close still report a busy connection while work is pending.This branch targets
mainindependently of #364. The iOS build job uses a generic simulator destination so it can compile without a named simulator installed on its runner.Reproduction
The device harness holds a transaction after an insert, submits 24 external writes, then rolls back. The transaction's row disappears and all 24 external rows remain. Another case submits 24 writes before a transaction and checks that the transaction sees every row.
The harness also checks 64 native async inserts for submission order, verifies that a failed batch rolls back without affecting async statements on either side, and confirms that a failed native query does not stop the FIFO. Unit tests cover pending transaction queries and immediate submission of batches and file imports.
The scheduling change addresses the
Promise.allworkload in the Expensify App review. An Expensify App TTI comparison on low-end iOS and Android devices remains necessary to measure its effect on startup.