I have seen the benchmarks on the Realm website, how come Realm is so fast compared to SQLite, which has a long development history, being released back in 2000?
I was wondering if someone with knowledge could share some general techniques that Realm uses underneath the hood in the database layer? As of March, 2016, only the bindings are open-sourced and the db layer is still closed off.
The main advantage of Realm, in contrast to SQLite, is enhanced speed and effectiveness. It's user-friendly and cross-platform. However, a new library for SQLite, Room, was introduced in 2017 and became a turning point in the competition between Realm and SQLite.
Realm uses its own engine, simple and fast. Thanks to its zero-copy design, Realm is much faster than ORM, and often faster than SQLite either.
Core Data is incredibly fast if you consider what it does under the hood to do its magic. But Realm is faster, much faster. Realm was built with performance in mind and that shows. As Marcus Zarra once said in a presentation, you don't choose Core Data for its speed.
Realm is an open source object database management system, initially for mobile operating systems (Android/iOS) but also available for platforms such as Xamarin, React Native, and others, including desktop applications (Windows), and is licensed under the Apache License.
The Realm blog has great technical talks on the subject, but there was no single repository that goes into depth about the reasons behind its performance. This post is an effort to condense the videos and articles in an easily accessible manner.
Realm is designed for mobile from the get-go that uses and therefore makes trade-offs that make sense in the mobile platform whereas SQLite is a generic solution that was ported to mobile.
There are of course a lot of small optimizations that Realm does (integer packing, converting common strings to enums), but in this post I'll try to focus on the differences that account for the most performance benefits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With