-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Switch to SQLite implementation of EntitiesRepository #6290
Conversation
e878244
to
c0bd11d
Compare
@getodk/testers this switches the implementation of entities storage over to a database. The goal here is to enable fast filtering for
I got to this kind of performance testing against the "100k Entities Filter" form with an emulator (running on a MacBook) so it could be that the results you see on a device are quite different. I'll have a play with an older phone as well, but thought it'd be good to get us all looking at it! What's for certain is I'm definitely seeing better overall performance (faster and lower memory use) compared than using these forms with what's currently on EDIT: You'll also be able to clear entities from the standard project reset settings now. |
We tried 100k entities on Android 10 (Redmi devices) and it seems to be working better. On 2 devices with Android 10 no probelms on downloading the form, refreshing the list of blank forms or filling the form. On Android 14 it works well, too. |
Great thanks! I think that's probably good enough for us to go ahead with reviewing/merging this, and then we can start more in depth performance testing/improvements after. |
collect_app/src/main/java/org/odk/collect/android/entities/DatabaseEntitiesRepository.kt
Outdated
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/entities/DatabaseEntitiesRepository.kt
Outdated
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/entities/DatabaseEntitiesRepository.kt
Outdated
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/entities/DatabaseEntitiesRepository.kt
Outdated
Show resolved
Hide resolved
androidshared/src/main/java/org/odk/collect/androidshared/sqlite/DatabaseConnection.kt
Show resolved
Hide resolved
androidshared/src/main/java/org/odk/collect/androidshared/sqlite/CursorExt.kt
Outdated
Show resolved
Hide resolved
entities/src/main/java/org/odk/collect/entities/storage/Entity.kt
Outdated
Show resolved
Hide resolved
entities/src/main/java/org/odk/collect/entities/LocalEntityUseCases.kt
Outdated
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/feature/settings/ResetProjectTest.kt
Outdated
Show resolved
Hide resolved
collect_app/src/androidTest/java/org/odk/collect/android/feature/settings/ResetProjectTest.kt
Outdated
Show resolved
Hide resolved
e9fb5f9
to
31efad7
Compare
entities/src/main/java/org/odk/collect/entities/storage/Entity.kt
Outdated
Show resolved
Hide resolved
Tested with Success Verified on device with Android 14 Verified cases:
|
Tested with Success Verified on a device with Android 10 and Android 8.1 |
Work towards #6012
Blocked by #6276The major changes here:
Why is this the best possible solution? Were any other approaches considered?
I think there are still a bunch of things we could do to get even better performance (both speed and memory wise) and to even make 1M item entity lists more credible, but this felt like a big enough milestone to merge before going any further.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
The big risk here is to filling and downloading entity list forms as it's mostly changes to how local entities are stored.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still passDateFormatsTest