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

Why are there synchronous and asynchronous builds? #7

Closed
rhashimoto opened this issue May 8, 2021 · 0 comments
Closed

Why are there synchronous and asynchronous builds? #7

rhashimoto opened this issue May 8, 2021 · 0 comments
Labels
faq

Comments

@rhashimoto
Copy link
Owner

@rhashimoto rhashimoto commented May 8, 2021

WebAssembly currently doesn't have native support for coroutines or continuations. That makes it difficult to connect SQLite with browser resources that are inherently asynchronous, like IndexedDB.

Asyncify is a clever workaround for that restriction. It postprocesses the .wasm file and adds some library support to effectively suspend some WebAssembly calls, run some asynchronous Javascript, and resume executing the WebAssembly. That can be used to bridge C's customarily blocking i/o, which SQLite uses, and the browser's asynchronous APIs (though not the only way).

Asyncify is amazing and awesome, but it isn't free. It makes the WebAssembly substantially larger and slower, particularly with SQLite which is something of a worst case. Developers can decide whether the costs are acceptable for their application, but the asynchronous build should only be used if it is actually needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq
Projects
None yet
Development

No branches or pull requests

1 participant