Skip to content

perf: drain SQLite operations through a native FIFO - #369

Open
chrispader wants to merge 3 commits into
mainfrom
codex/native-operation-fifo
Open

chrispader wants to merge 3 commits into
mainfrom
codex/native-operation-fifo

Conversation

@chrispader

@chrispader chrispader commented Sep 18, 2026

Copy link
Copy Markdown
Member

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 through setImmediate. 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 main independently 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.all workload 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.

@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-native-nitro-sqlite Ready Ready Preview Sep 18, 2026 7:33pm UTC

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant