Hello Devs.
It's been a while since I wrote anything on this lovely platform.
Recently I've been working on a personal project for developing an app using .NEt MAUI framekwork. I've been looking for options for local storage, and of course the two big contenders are LiteDB, and SQLite. Both are great projects with much to offer.
I'm not going to compare both since they have completely different use cases -one for NoSQL document based, and the other is relational DB-. Each database has pros and cons, and use cases, and there are tons of materials out there that discuss in depth the benefits and trade-offs of each approach.
However, I couldn't find any recent comparison in terms of performance, especially in the context of a modern .NET application let alone MAUI.
As any good Dev citizen I whopped up a git repo for a testing project. You can simply just clone the repo, and run it in your favorite target framework or emulator.
naderelshehabi
/
LocalDBTest
A repo to compare performance of both LiteDB and SQLite in DotNET MAUI apps
LocalDBTest
Purpose
This repository is designed to compare the performance of two common embedded databases, namely SQLite and LiteDB, in .NET MAUI applications. The project can be easily deployed to devices, emulators, and other MAUI target frameworks. Users can run the app and press the 'Run Test' buttons for each database engine to see the performance metrics.
Getting Started
- Clone the repository to your local machine.
- Open the solution file
LocalDBTest.sln
in Visual Studio. - Deploy the app to your desired target (device, emulator, etc.).
- Run the app and press the 'Run Test' buttons for SQLite and LiteDB to collect performance metrics.
The local database is cleared at the beginning of each test run.
Metrics Collected
The app collects the following performance metrics for each database engine:
- Insertion Time: The time taken to insert a set number of records into the database.
- Query Time: The time taken to query…
Few things to consider:
- The purpose of this repo and article is to explore more recent performance comparison between both databases in specific context of DotNet MAUI apps
- Always consider your use cases, and whether a relational database is more aligned with your data models vs document based -NoSQL-.
- The code is not thoroughly optimized for each database. It's a quick shot at getting like-for-like comparison.
If you are too lazy to run the project yourself, there are screenshots in the repo -and below- for a run I did on Android emulator.
Let me know in the comments or in the repo what you think.
Cheers!
Top comments (0)