Open daonsh opened 4 years ago
long-term i agree sql.js should be used instead of native in nodejs. however,
webassembly is still experimental and hidden behind a flag in nodejs (making it unsuitable for production use). this hopefully will go away in 2 years with node v14.
also, there's no way to incrementally persist a 1gb database in sql.js (you have to rewrite the entire blob to local filesystem everytime you update it). the webassembly-group will need to come up with new filesystem api's to overcome this limitation.
Performance wise which is better?
sql.js takes long time for me. Maybe I am missing something
Using the native sqlite is faster and lighter.
what's the maximum storage limitation of sql.js?
depends on browser. for chrome it appears to be 4gb (https://v8.dev/blog/4gb-wasm-memory). My experience however, is chrome-browser (windows 10) starts to freeze and crash when working with datasets over 1gb.
Any reason why sql.js wouldn't be suitable for use with an ORM? (I'm using the sqlite support in typeorm). Would it be unrealistic to expect to expect the adapter to work with sql.js also?
E2A - i see comments here but perhaps he's mistaken
Hi,
Thanks for this project, it's very useful. I see in the homepage of SQLjs that it's recommended to use SQLite native if using server-side NodeJS code. However there is an example of using SQLjs with NodeJS.
Comparing the two options, I see several advantages to using SQLjs with NodeJS:
The only downside I see is that Emscripten code is usually at 50-60% of the performance of native code. So SQLjs is slower (how much?).
Is my reasoning correct? Especially regarding point #3 - I couldn't find a viable solution to load the file into memory with SQLite native (fast), while SQLjs can easily do this.
Thanks