realm / realm-kotlin

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

Benchmark bulk inserts (Realm.insert()) #959

Open sync-by-unito[bot] opened 1 year ago

sync-by-unito[bot] commented 1 year ago

Realm Java has a dedicated API for bulk inserting large amounts of data. Realm.insert() and Realm.insertOrUpdate().

It is currently unclear if that optimization is also needed in Realm Kotlin.

The first step is benchmarking inserting large amounts of data and comparing it against Realm Java.

PhilTdr commented 8 months ago

I have written a benchmark test for our project that imports a "real" dataset into realm: The data model has multiple String, Double, Int, Boolean properties and an embedded RealmList with a range of 0 to 4 elements containing String and Long properties.

RealmKotlin Write 100K Items: 23027 ms Write 1M Items: 149549 ms

realm.write { data.map { item -> copyToRealm(item) } }

RealmJava Write 100K Items: 4031 ms Write 1M Items: 25088 ms

realm.executeTransaction { realm.insert(data) }

(Testing on Android. RealmKotlin 1.11.1, RealmJava 10.17.0)

dhng22 commented 5 months ago

Any updates for bulk operation?

SagarMahadik commented 1 month ago

Please prioritise this feature. Would be of great help for apps with large data.Thanks..