DEV Community

Cover image for SQLite vs LiteDB performance comparison for .NET MAUI apps
Nader Elshehabi
Nader Elshehabi

Posted on

SQLite vs LiteDB performance comparison for .NET MAUI apps

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.

GitHub logo 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

  1. Clone the repository to your local machine.
  2. Open the solution file LocalDBTest.sln in Visual Studio.
  3. Deploy the app to your desired target (device, emulator, etc.).
  4. 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:

  1. The purpose of this repo and article is to explore more recent performance comparison between both databases in specific context of DotNet MAUI apps
  2. Always consider your use cases, and whether a relational database is more aligned with your data models vs document based -NoSQL-.
  3. 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.

Image description

Image description

Image description

Image description

Image description

Cheers!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay