-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Electronjs application freeze problem on database reading #241
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
Comments
I have the same problem! @fkomaralp do you found any solution or alternative to that? |
In my electron app, |
@linonetwo Your problem does not seem to be the same as the one described above. If you are making an electron application, then I would suggest using a native SQLite instead of this project. It will load faster and avoid freezes. For instance, you can use https://www.npmjs.com/package/sqlite3 |
@fkomaralp can you reproduce the problem with the latest WASM |
It's difficult to get native modules work, even sqlite3. I thought WASM will work in electron v5, but seems it's not. |
Both native module and wasm can work in electron. You should prefer native modules for performance. Electron has a documentation page dedicated to them. In any case, please report issues to sql.js only when you have a clean and reproducible example. |
For the record, Electron’s renderer GUI will stutter while you are doing something blocking in the main thread, like reading data. This is how Electron works, it’s not a fault of SQL.js. The solution for that that I prefer is using Node worker threads, and performing all expensive computations in there. In the main thread you’d start the worker, and during runtime you’d pass messages to it and get the results. Note: the Node workers I am talking about run in Electron main thread. This is not the same as Web workers, which run in renderer. The worker bundled with SQL.js is a Web worker. However, I think SQL.js exposes basic APIs that you can wrap in Node workers yourself. I am considering this personally, as I’m choosing a fast storage to use for caching data used by my Electron app. With a library like https://threads.js.org (which I already use) it is possible to give your workers nice async APIs, and not have to deal with message passing. |
Hi, I have a question. I'm working on electronjs app and I need a db on this application. My database read code is
While reading database my electronjs app freeze a little bit time. After read database application is working normal. How can I solve this problem? On line SQL.Database(filebuffer)
The text was updated successfully, but these errors were encountered: