Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPFS support #245

Open
fabiospampinato opened this issue Aug 21, 2023 · 2 comments
Open

OPFS support #245

fabiospampinato opened this issue Aug 21, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@fabiospampinato
Copy link

It'd be interesting if the browser version of this package used the origin-private file-system APIs rather than IndexedDB. I think that's become kinda the "official" way to run sqlite in the browser nowadays.

@rhashimoto
Copy link

OPFS beats IndexedDB in in raw I/O performance and having a mostly synchronous API, but there are still quite a few reasons a particular application might prefer IndexedDB:

  • OPFS access handles don't work in a SharedWorker.
  • OPFS access handles don't work in a service worker.
  • OPFS access handles don't work in a browser extension.
  • IndexedDB has better browser support.
  • IndexedDB can allow trading durability for performance.
  • IndexedDB can be much faster with small write transactions (though slower at almost everything else).

I don't think it makes sense to say that either OPFS or IndexedDB is the only way to implement SQLite storage. And if you're only going to do one, I think for a library targeting lots of different applications there's a reasonable argument that IndexedDB's greater flexibility can outweigh OPFS's mostly performance-related benefits.

@dyedgreen
Copy link
Owner

We could support both relatively easily (assuming we make a VFS that supports OPFS). The current browser support uses an import map to replace the VFS so it’s quite easy to swap in another one!

@dyedgreen dyedgreen added enhancement New feature or request help wanted Extra attention is needed labels Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants