realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

RealmKotlin.copyToRealm magnitures slower than RealmJava.insertOrUpdate

Open BlueCobold opened this issue 6 months ago • 2 comments

How frequently does the bug occur?

Always

Description

I have migrated from RealmJava 10.16.0 to RealmKotlin 1.16.0 and I have a piece of conversion code which creates RealmObjects from my model classes and then used insertOrUpdate to update the realm file. However, after migrating to RealmKotlin, I tried using copyToRealm with UpdatePolicy.ALL. And I also tried to sequentially query and update all the properties of the existing RealmObjects in my db with the values of my model files and in both cases, the time it takes to update all the objects (quite a lot) increased from ~2 seconds to about 20-40. This is a significant increase in execution time. The issue does not exist on RealmSwift either.

I am a bit helpless here at the moment, because I don't want to be stuck with RealmJava for too long anymore, but this issue is blocking a migration effectively.

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

Fetch all objects from the realm including nested/children, then deep-clone the objects and call a copyToRealm(data, UpdatePolicy.ALL) in a new write-block.

Version

1.16.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

Android any

Build environment

Android Studio version: 2023.3.1 Android Build Tools version: 34 Gradle version: 8.4

BlueCobold avatar Aug 30 '24 11:08 BlueCobold