perf: drain SQLite operations through a native FIFO - #369
Open
chrispader wants to merge 3 commits into
Open
chrispader wants to merge 3 commits into
chrispader wants to merge 3 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 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 currently waits for its predecessor's result to return through JavaScript before submitting native work. That gap adds overhead to bursts such as
Promise.all, and the queue also schedules every operation throughsetImmediate. This PR submits ordinary queries immediately to a native FIFO on the connection while preserving the JavaScript queue's transaction and lifecycle guards.One native worker drains each active connection's async statements, batches, and file imports in submission order. The JavaScript queue waits for all earlier statements before starting a transaction and holds later work until its callback commits or rolls back. This preserves the rollback isolation introduced in #326. Synchronous operations and close still report the connection as busy 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. A second case submits 24 writes before a transaction and checks that the transaction sees every row.
The harness also submits 64 native async inserts together and checks that their insert IDs match submission order. It then queues a batch followed by another insert and checks their order. These cases exercise the native FIFO directly, without the JavaScript queue.
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 quantify its effect on startup.