Skip to content

perf: drop promise layers from async queries - #496

Open
chrispader wants to merge 2 commits into
mainfrom
perf/async-queue-overhead
Open

chrispader wants to merge 2 commits into
mainfrom
perf/async-queue-overhead

Conversation

@chrispader

Copy link
Copy Markdown
Member

Every async query went through several async functions before it reached the native promise. Each one added a promise and microtask turns, which made executeAsync slower than op-sqlite when many queries were in flight. executeAsync, executeRawAsync, prepared statement executions and the operation queue now chain the native promise directly. Synchronous errors and closed connections still come back as rejected promises, and the queue still updates its state before the caller's continuation runs.

On Release builds in margelo/sqlite-bench, 250 point reads in flight on a Galaxy S10 went from 138 to 153 µs per query to 100 to 102 µs (op-sqlite: 86 to 99 µs). Sequential async point reads on an iPhone 14 Pro went from 41.7 to 42.5 µs to 36.9 to 37.0 µs (op-sqlite: 41.7 to 45.7 µs).

Fixes #495

🤖 Generated with Claude Code

executeAsync, executeRawAsync and prepared statement executions went through several async functions and an awaiting queue wrapper, which added promises and microtask turns to every query. They now chain the native promise directly and still report synchronous errors as rejected promises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
react-native-nitro-sqlite Skipped Skipped Nov 14, 2026 11:39am UTC

Request Review

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
Preview — 8507047d Deployed Nov 14, 2026 by vercel[bot]
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.

perf: async queries pay for extra promise layers in the JS wrapper

1 participant