requery / sqlite-android

Android SQLite support library
Apache License 2.0
1.05k stars 138 forks source link

Remove STL dependency #161

Closed ebraminio closed 1 year ago

ebraminio commented 1 year ago

This patch removes STL dependency of the library and turns resulting sqlite-android-debug.aar from 3,811,548 bytes to 3,450,656 bytes.

The only STL use on the project was std::string which was relatively easy to get rid of but sure the change needs to be tested whether it doesn't change anything (tbh I didn't test the resulting binary yet)

Given the size decrease hopefully reviewing the change is worth to hassle.

Thanks!

Update: in 3.39.0 changes 3,801,068 bytes to 3,442,739 bytes

npurushe commented 1 year ago

thanks will review and test the changes

ebraminio commented 1 year ago

Rebased with 3.39.0 of master which the upgrade itself is apparently saving 10kb itself (a little suspicious but well)

ebraminio commented 1 year ago

Not to push for the process or anything at all, just am putting my testing result also, apparently no matter the change testConstructorDifferentSize is failing, more on this on #162, and here is the benchmark result which its change feels more like a noise,

Benchmarks result:

07-08 02:00:43.731  9442  9464 I TestRunner: started: runBenchmark(io.requery.android.database.benchmark.Benchmark)
07-08 02:00:45.082  9442  9464 I SQLite  : Android Write 1345ms
07-08 02:00:45.136  9442  9464 I SQLite  : Android Read 54ms
07-08 02:00:46.246  9442  9464 I SQLite  : requery Write 1109ms
07-08 02:00:46.289  9442  9464 I SQLite  : requery Read 42ms
07-08 02:00:47.523  9442  9464 I SQLite  : Android Write 1222ms
07-08 02:00:47.551  9442  9464 I SQLite  : Android Read 27ms
07-08 02:00:48.488  9442  9464 I SQLite  : requery Write 937ms
07-08 02:00:48.512  9442  9464 I SQLite  : requery Read 23ms
07-08 02:00:49.689  9442  9464 I SQLite  : Android Write 1170ms
07-08 02:00:49.716  9442  9464 I SQLite  : Android Read 27ms
07-08 02:00:50.706  9442  9464 I SQLite  : requery Write 989ms
07-08 02:00:50.732  9442  9464 I SQLite  : requery Read 25ms
07-08 02:00:52.045  9442  9464 I SQLite  : Android Write 1307ms
07-08 02:00:52.075  9442  9464 I SQLite  : Android Read 29ms
07-08 02:00:53.078  9442  9464 I SQLite  : requery Write 1002ms
07-08 02:00:53.106  9442  9464 I SQLite  : requery Read 28ms
07-08 02:00:54.302  9442  9464 I SQLite  : Android Write 1190ms
07-08 02:00:54.330  9442  9464 I SQLite  : Android Read 28ms
07-08 02:00:55.255  9442  9464 I SQLite  : requery Write 924ms
07-08 02:00:55.277  9442  9464 I SQLite  : requery Read 22ms
07-08 02:00:55.282  9442  9464 I SQLite  : Android: Read AVG 33.0 Write AVG 1246.8
07-08 02:00:55.282  9442  9464 I SQLite  :  Rows/sec 303030.3 Inserts/sec 8020.5327
07-08 02:00:55.282  9442  9464 I SQLite  : requery: Read AVG 28.0 Write AVG 992.2
07-08 02:00:55.282  9442  9464 I SQLite  :  Rows/sec 357142.84 Inserts/sec 10078.613
07-08 02:00:55.282  9442  9464 I TestRunner: finished: runBenchmark(io.requery.android.database.benchmark.Benchmark)

After:

07-08 02:06:46.036  9611  9633 I TestRunner: started: runBenchmark(io.requery.android.database.benchmark.Benchmark)
07-08 02:06:47.487  9611  9633 I SQLite  : Android Write 1443ms
07-08 02:06:47.539  9611  9633 I SQLite  : Android Read 51ms
07-08 02:06:48.560  9611  9633 I SQLite  : requery Write 1020ms
07-08 02:06:48.596  9611  9633 I SQLite  : requery Read 36ms
07-08 02:06:49.804  9611  9633 I SQLite  : Android Write 1199ms
07-08 02:06:49.830  9611  9633 I SQLite  : Android Read 26ms
07-08 02:06:50.778  9611  9633 I SQLite  : requery Write 948ms
07-08 02:06:50.801  9611  9633 I SQLite  : requery Read 23ms
07-08 02:06:52.024  9611  9633 I SQLite  : Android Write 1216ms
07-08 02:06:52.052  9611  9633 I SQLite  : Android Read 27ms
07-08 02:06:52.494  1448  7802 E WakeLock: GCM_HB_ALARM release without a matched acquire!
07-08 02:06:52.514   222   225 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup34: Permission denied
07-08 02:06:52.523   222   225 E android.system.suspend@1.0-service: Error opening kernel wakelock stats for: wakeup35: Permission denied
07-08 02:06:52.507   222   222 W Binder:222_2: type=1400 audit(0.0:1635): avc: denied { read } for name="wakeup34" dev="sysfs" ino=19159 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
07-08 02:06:52.519   222   222 W Binder:222_2: type=1400 audit(0.0:1636): avc: denied { read } for name="wakeup35" dev="sysfs" ino=19222 scontext=u:r:system_suspend:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
07-08 02:06:53.012  9611  9633 I SQLite  : requery Write 959ms
07-08 02:06:53.035  9611  9633 I SQLite  : requery Read 23ms
07-08 02:06:54.260  9611  9633 I SQLite  : Android Write 1219ms
07-08 02:06:54.288  9611  9633 I SQLite  : Android Read 28ms
07-08 02:06:55.523  9611  9633 I SQLite  : requery Write 1234ms
07-08 02:06:55.557  9611  9633 I SQLite  : requery Read 34ms
07-08 02:06:56.772  9611  9633 I SQLite  : Android Write 1207ms
07-08 02:06:56.799  9611  9633 I SQLite  : Android Read 27ms
07-08 02:06:57.713  9611  9633 I SQLite  : requery Write 913ms
07-08 02:06:57.736  9611  9633 I SQLite  : requery Read 23ms
07-08 02:06:57.741  9611  9633 I SQLite  : Android: Read AVG 31.8 Write AVG 1256.8
07-08 02:06:57.741  9611  9633 I SQLite  :  Rows/sec 314465.44 Inserts/sec 7956.7153
07-08 02:06:57.741  9611  9633 I SQLite  : requery: Read AVG 27.8 Write AVG 1014.8
07-08 02:06:57.741  9611  9633 I SQLite  :  Rows/sec 359712.25 Inserts/sec 9854.158
07-08 02:06:57.741  9611  9633 I TestRunner: finished: runBenchmark(io.requery.android.database.benchmark.Benchmark)
ebraminio commented 1 year ago

Hi, can you have a look at this? Thanks!

npurushe commented 1 year ago

Hi could you rebase your PR on master? this should run the CI and confirm the build/test process for this change is ok, thanks! (otherwise the change seems fine)

ebraminio commented 1 year ago

Hi could you rebase your PR on master? this should run the CI and confirm the build/test process for this change is ok, thanks! (otherwise the change seems fine)

Done

ebraminio commented 1 year ago

guess this can be mentioned on the ChangeLog or not.

npurushe commented 1 year ago

Thanks! Sure I can update it on the next release

ebraminio commented 1 year ago

Just an unrelated question, any general interest on migrating to Gradle's Kotlin DSL for the build system language instead Groovy system? I've done parts of it already locally but was unsure if you would like it or not, generally it makes the build scripts easier to maintain and reveals things like this https://stackoverflow.com/a/67803541 but some don't like it.