Unrealm icon indicating copy to clipboard operation
Unrealm copied to clipboard

How to improve performance on large datasets ?

Open Venkata-Maniteja opened this issue 3 years ago • 4 comments

Hi,

I'm using unrealm to support structs as realm objects. However this comes with a performance hit.

I observed few things. LEts say there are 10k records in realm.

Reading the results from realm is pretty quick, its less than a second for those 10k items.

And when I try to convert them into an array, it becomes too slow. It is only converting 100 items per second into an array, so for 10k items, it is taking 100secs.

Do you recommend any solution to improve the loading speed ?

NOTE: I want to convert the realm results into an array because , I cant use predicates on structs. If I use class, I loose the swift features on struct.

Sample code:

        extension Task {
              static func all() -> Results<Task>? {
                    if let realm = try? Realm() {
                          return realm.objects(Task.self)
                    }
                     return .none
              }
        }
        if let tasks = Task.all() {
            DataManager.shared.tasks = Array(tasks)
        }

Venkata-Maniteja avatar Jul 17 '20 10:07 Venkata-Maniteja

I'm already working on some optimization/caching the schemes which seem take a long time/. Will release a new version in a few days.

arturdev avatar Jul 17 '20 10:07 arturdev

@arturdev was this enhancement ever released?

Thanks, Dan

DanBurkhardt avatar Aug 11 '20 05:08 DanBurkhardt

Is there any updates on this topic?

mladjan avatar Nov 08 '20 14:11 mladjan

Would be interesting to know if there has been some development.

HKdAlex avatar Dec 25 '20 09:12 HKdAlex