Skip to content

Conversation

@rkistner
Copy link
Contributor

@rkistner rkistner commented Aug 5, 2024

sqlite-js: Universal SQLite APIs for JavaScript

Currently provides a NodeJS driver and a better-sqlite3 driver.

Future work:

  • Implement update notifications.
  • Well-defined error handling behavior.
  • Proper concurrency testing.
  • CJS build

@sqlite-js/driver

This is a universal driver API and utilities for implementing drivers.

The APIs here are low-level, and should not be used directly by most apps. It is however a good target for other libraries.

@sqlite-js/driver/node

This is a driver implementation for NodeJS based on the experimental node:sqlite package.

This has some severe limitations, such as no extension support. Therefore not usable by Powersync.

@sqlite-js/better-sqlite3-driver

This is a driver implementation for NodeJS implementation based better-sqlite3. A good driver for PowerSync on NodeJS.

@sqlite-js/api

This contains a higher-level API, including transaction support. This is mostly a proof-of-concept right now, as a more fully-featured alternative to the current PowerSync query APIs.

benchmarks

Benchmarks comparing direct usage of better-sqlite3, node:sqlite, sqlite3 and the APIs here. The implementation here can generally not be faster then better-sqlite3 / node:sqlite, since it adds a layer on top of that. However, the performance gets close when using pipelining.

Using a connection pool involves worker threads which does significantly slow down the benchmarks. We do get close again when using pipelining or batching via JSON1.

@rkistner rkistner changed the title API v1 sqlite-js Aug 19, 2024
@rkistner rkistner marked this pull request as ready for review August 27, 2024 08:59
Copy link

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks amazing. There are some nice gems in here.

@rkistner rkistner merged commit 6672b66 into main Aug 27, 2024
@rkistner rkistner deleted the api-experiments branch August 27, 2024 11:13
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.

3 participants