Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Realm vs Sqlite for mobile development [closed]

Tags:

Am an Xamarin Developer , I used to use Sqlite as mobile database ,
recently Realm comes to the picture.
Any idea about Differences between them in Performance & ease of use..etc?

What is the best practice of using either one?

like image 372
Medo Medo Avatar asked May 11 '16 01:05

Medo Medo


People also ask

Is SQLite faster than Realm?

This database flawlessly works with Java, Kotlin, Swift, Objective-C, Xamarin, and React Native. The tool is currently gaining popularity among mobile engineers. The main advantage of Realm, in contrast to SQLite, is enhanced speed and effectiveness.

Is SQLite good for mobile apps?

SQLite is very good for testing. Zero-configuration: SQLite doesn't need any complex set up to store the data. When you build Native applications with Java, it comes integrated with the platform. Developers call SQLite, a serverless database and it really lives up to the expectation.

Why is SQLite not good for production?

SQLite doesn't support any kind of concurrency, so you may have problems running it on a production website.

When should you not use SQLite?

A good rule of thumb is to avoid using SQLite in situations where the same database will be accessed directly (without an intervening application server) and simultaneously from many computers over a network. SQLite will normally work fine as the database backend to a website.


1 Answers

I'm a developer on the Xamarin team at Realm so I can tell you a bit more about how the Xamarin product works.

Realm has a C++ core which is common across all products. That is why we release for each platform rather than just a language - we need to include the native core. Whilst we support PCL builds of your code, we don't have a PCL library as such - at build time your PCL code will link to the matching IOS or Android library.

All the Realm products are individually developed to provide an idiomatic interface for a given programming language, with as slim a layer as possible between your code and the data.

That means, for example, the C# product provides LINQ for querying and uses C# objects as the means of defining the data model. At build time, the Fody code generator is run to add property setters and getters so your C# objects will directly interact with the core C++ data. Unlike typical ORM products, there's no copying of data from the database into buffers and then again into your objects.

Realm data is memory-mapped so it's going directly from your code to storage. We generate accessor methods that replace the auto-property getters and setters.

We use the term zero-copy to describe this. In contrast, most other systems will have C# objects which have fields backing their properties. Those objects are often populated by copying from a SQLite buffer which has been read from the disk storage. That's two levels of copying.

like image 72
Andy Dent Avatar answered Sep 20 '22 09:09

Andy Dent