mobilexag / cordova-sqlite-evplus-ext-free

Other
0 stars 2 forks source link

Android insertion performance fix WIP DO NOT MERGE #6

Closed brodycj closed 6 years ago

brodycj commented 6 years ago

Here is a solution for the performance issue discussed in litehelpers/Cordova-sqlite-evcore-extbuild-free#39, WIP for TESTING ONLY at this point. Note that this change will NOT work on iOS, macOS, or Windows, also does NOT support the androidDatabaseImplementation: 2 setting.

If this change does resolve the insertion performance issue on Android I will work on a more integrated solution that works across all supported platforms, as well as the browser platform in the near future.

To test: completely remove existing sqlite plugin, verify that no other form of sqlite plugin is installed, and install this WIP version as follows:

cordova plugin add https://github.com/mobilexag/cordova-sqlite-evplus-ext-free#cb-perf-fix-wip
brodycj commented 6 years ago

In general I was able to eliminate a couple loops through the sqlBatch statements as well as a per-statement subloop through the parameters. I am extremely hopeful that this will be able to bring the batch insertion performance to an acceptable level.

tobiaswaltl commented 6 years ago

For blocks of 2,000 inserts each, the optimization saves us approx. 600 ms on average per commit (i.e. it needs 1.6 s instead of 2.2 s). So considering that for some clients we have lots of these blocks, it is definitely a measurable performance improvement.

brodycj commented 6 years ago

Thanks @tobiaswaltl for the feedback. That is definitely some encouraging news though not as much as I was hoping for.

brodycj commented 6 years ago

Now integrated along with some other updates in #7, closing.