realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
889 stars 52 forks source link

Realm-Kotlin open is too slow compares to Realm-Android #908

Open thuannv opened 2 years ago

thuannv commented 2 years ago

I was experience about the slow startup time by opening Realm Kotlin instance. The more schema classes is added to the RealmConfiguration, the more is slow start.

I experience that on my same android phone Samsung A02s, open a Realm Kotlin instance took 4362ms while Realm Android took just 58ms. I tried reducing from 34 schema classes to 5 scheme classes, it took more than 1000ms to open a realm instance. It hugely reducing opening time when I reduced number of schema classes. Even though, it still took a lot more time in comparison to Realm Android.

As, I am using Kotlin Multiplatform Mobile for my MoMo app - a number one E-Wallet Application in Vietnam, with more than 30 millions of users, It is hugely impacted to our application cold start, slowing down the time to interaction. Hope Realm-Kotlin team tries figuring out this issue and solving it to make Realm-Kotlin more powerful.

I'm so thankfully and highly appreciate for your endeavor.

rorbech commented 2 years ago

Thanks for your feedback. We have mainly focussed on API surface until now, but we are aware of areas for optimization and are starting to address them.

Regarding your use case, with Realm Kotlin you can now open and share your realm instance across thread. This should make it easier to centralize this in an asynchroneous manner to unblock UI operations and initilize things when the realm is ready.