-
Notifications
You must be signed in to change notification settings - Fork 121
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
This plugin creates "long tasks" when used on the web, even for simple sql #579
Comments
I am now comparing the performance with a Dexie.js sample app and with Dexie.js there are no "long tasks" happening, with the same 20x CPU slowdown: I used this example angular repo from here:
To make the comparison fair, I made both sample apps create a single simple new entity. The performance difference is very large imo. But I am new to web browser performance so please let me know if my experiment is flawed or anything As you can see in the dexie.js image, the database operations in Dexie.js usually run 10x slower (roughly at 25ms, sometimes even less) than with capacitor-sqlite (even though both plugins use indexedDB afaik, but only capacitor-sqlite uses sql-wasm). |
@folsze I also considered using better-sqlite3, which I use for the Electron plugin, but it is tailored for Node.js environments, allowing direct modifications to SQLite files on the server or local filesystem. While Dexie.js can store data directly in IndexedDB, it doesn’t function as a SQLite database. Although one could potentially create a wrapper to bridge SQLite with Dexie, that falls well outside the scope of jeep-sqlite. I hope this clarifies why jeep-sqlite was designed this way. We do have to accept the limitations imposed by the WebAssembly file. Thank you for your understanding. Since there isn’t anything further we can do, I will go ahead and close the issue. |
Related thought: I know that absurd-sql achieved better performance than raw indexedDb. It does use sql-wasm if I understand correctly. https://jlongster.com/future-sql-web#tradeoffs-what-tradeoffs |
On the web, when inspecting with slowdown CPU power, this plugin yields lots of long tasks, mainly due to sql-wasm usage.
The CPU power I set to 20x slowdown in google chrome performance tab.
Check the profiler image, all the red tasks are slow and all of them mainly due to sql-wasm:
All you need for reproducing this is cloning this repo:
https://github.com/jepiqueau/blog-tutorials-apps.git
Then run this project which I used in the above screenshot:
and adding a new entity with the plus:
https://github.com/jepiqueau/blog-tutorials-apps/tree/main/SQLite/Part-1/ionic7-angular-sqlite-app
So my questions:
Thanks for any info you can provide :)
The text was updated successfully, but these errors were encountered: