Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm for iOS. Lazy data loading?

Tags:

ios

realm

I am trying to use Realm in my new project. But am interested in:

I have 10k objects of MyType. And I want to filter and display only most recent 10 of them.

Will all of them be moved to RAM to operate/filter them? 'realm.objects(MyType).filter(...)' - I'm just worried about 10k objects and their data would litter the app memory in case of query like above.

No? It's OK?

like image 430
bronenos Avatar asked Jan 28 '26 17:01

bronenos


1 Answers

When you filter objects, your query is constructed in a C++ DSL, which is efficiently evaluated, bringing in some optimizations to run it fast depending on the concrete property types. Accessor objects are instantiated by the binding lazily when you retrieve each object out of your results. So in your case only for the first 10 objects.

like image 176
marius Avatar answered Jan 31 '26 09:01

marius



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!