Realm Database 6.0 (beta): A New Architecture and Frozen Objects

I’m very excited to share that Realm Database 6.0, a major milestone on the MongoDB Realm roadmap, is now available as a beta release. Realm Database 6.0 is currently included in the Realm Java 7.0, Cocoa 6.0, and JavaScript / React Native 4.0 SDKs and will follow later in .NET/Xamarin 5.0.

This effort lays a new foundation that further increases the stability and performance of the Realm Database and will allow us to quickly release and iterate on new features in the future.

A few highlights:

  • The new architecture makes it faster to look up objects based on a primary key.
  • iOS benchmarks show faster insertions, twice as fast sorting, and ten times faster deletions.
  • Code simplifications yielded a ten percent reduction in total lines of code and a smaller library.
  • Realm files are now much smaller when storing big blobs or large transactions.
  • Realm now supports Frozen Objects, making it easier to use Realm with reactive frameworks.

For further details please see the Realm Database 6.0 Release Announcement.

Regards,
Stennie

Do Frozen objects live update? They are clearly immutable code-wise but do they maintain a link to the original backing objects?

What’s the difference between feezing an object to make it thread safe, like this

val frozenObject: RealmObject<Person> = liveObject.freeze() //an example

and making an in-memory copy of that object, which is also thread safe (and mutable)?

let standaloneModelObject = MyModel(value: persistedModelObject)

(given that a Realm and RealmList can also be frozen).

No, frozen objects do not live update once frozen.

If you are copying values from a frozen object into your own immutable class (MyModel), then the only difference is that the frozen model is more memory efficient and you can still query it like normal. But if you are doing something like realm.copyFromRealm(obj) then nothing stops you from modifying the returned object as it has var properties.