You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(sqlite-ext): reuse prepared helper state on local UDF hot paths #70
Reduce steady-state overhead in the SQLite extension local operation path by reusing prepared helper state instead of rebuilding statement-heavy helper objects for each local operation.
Problem
The local sqlite-ext path still constructs fresh helper objects per operation, even on hot paths:
SqliteNodeStore::prepare(db)
SqlitePayloadStore::prepare(db)
SqliteParentOpIndex::prepare(db, doc_id)
Those helpers prepare one or more SQLite statements each time they are created. That is likely avoidable overhead for repeated local insert / move / delete / payload operations, especially in wa-sqlite worker mode.
Goal
Reuse or cache prepared helper state per SQLite connection so local UDFs do not repeatedly pay the full setup cost on the steady-state path.
Possible approaches
Maintain a per-sqlite3* cache of prepared helper objects.
Store per-connection helper state with a lifetime-managed SQLite attachment mechanism.
If full helper caching is too invasive, reduce the number of prepared statements or split out lighter-weight hot-path helpers.
Scope
This issue is about the whole local sqlite-ext hot path, not just one operation kind.
changed the title [-]perf(sqlite-ext): cache prepared statements for local UDF hot paths[/-][+]perf(sqlite-ext): reuse prepared helper state on local UDF hot paths[/+]on Apr 22, 2026
Activity
marcus-pousette commentedon Apr 22, 2026
Rewrite proposal for current scope:
This issue is still valid, but the current body is tied too tightly to the older local-delete / order-key wording.
What is still true:
What is stale:
Suggested rewrite:
[-]perf(sqlite-ext): cache prepared statements for local UDF hot paths[/-][+]perf(sqlite-ext): reuse prepared helper state on local UDF hot paths[/+]