Repository navigation
perf: begin deferred transactions synchronously - #501
Open
chrispader wants to merge 1 commit into
Open
chrispader wants to merge 1 commit into
chrispader wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Every transaction awaited BEGIN through executeAsync, a round trip to the connection's worker thread and back, while COMMIT and ROLLBACK already ran synchronously. A deferred BEGIN takes no lock and returns at once, so it now runs synchronously too. The callback still starts after transaction() returns, one microtask later instead of after the round trip. BEGIN EXCLUSIVE stays async because it can wait for another connection's lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chrispader
force-pushed
the
async-overhead/sync-begin
branch
from
November 16, 2026 16:33
a414fac to
8fd97e3
Compare
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.
Every transaction started by awaiting
BEGIN TRANSACTIONthroughexecuteAsync(), which sends the statement to the connection's worker thread and waits for the result to come back to JavaScript.COMMITandROLLBACKalready run synchronously. In a per-call probe on a Galaxy S10, one async point read awaited on its own took 0.6 to 1 ms, against about 0.1 ms per read with many reads in flight.A deferred
BEGINtakes no lock and returns immediately, so it now runs synchronously likeCOMMIT. The callback still starts aftertransaction()returns, one microtask later instead of after the round trip.BEGIN EXCLUSIVE TRANSACTION, used whenNitroSQLite.transaction()getsisExclusive, stays async because it can wait for another connection's lock.🤖 Generated with Claude Code