Skip to content

Benchmark Database

Théophile JR edited this page Oct 30, 2024 · 3 revisions

There are many databases available on the market, Postgres, MariaDB, SQL Server... We are going to explain why sqlite3.


Reasons for Choosing SQLite

1. Simplicity and Ease of Installation

  • No Server Setup Required: SQLite is a self-contained, serverless database engine, eliminating the need for complex configurations or server management.
  • Built-in with Standard Libraries: Most programming environments and systems include SQLite by default, making it easy for any developer to start with minimal setup.
  • One-File Storage: All data is stored in a single .sqlite file, which is portable and easy to manage.

2. Ideal for Single-User or Low-Concurrency Applications

  • Concurrency Management: While SQLite may not be optimized for highly concurrent environments, it excels in single-user applications, which is typically the case in local game databases.
  • Read-Heavy Optimization: For games like R-Type, where read operations (e.g., loading player data, configurations, and levels) dominate, SQLite’s efficient read capabilities make it an excellent choice.

3. Performance

  • Fast Read and Write Speeds: For a 2D game, SQLite provides sufficient speed to handle in-game data loading and saving without noticeable delays.
  • In-Memory Mode Option: For faster operations, SQLite can operate entirely in memory, which may be useful for temporary data during gameplay.

4. Portability

  • Cross-Platform Compatibility: SQLite works across multiple platforms (Windows, macOS, Linux), ensuring that the database can be easily set up and accessed regardless of the development environment.
  • Easy Backup and Restore: Since the entire database is stored in a single file, it’s easy to create backups or move data across devices.

Comparison with Other Databases

Feature SQLite MySQL/PostgreSQL MongoDB
Setup Complexity Very Low High Moderate
Server Requirement No Yes Yes
Concurrency Support Low (Single-User) High High
Data Type Support Limited Extensive Schema-less
Data Portability High (Single File) Moderate Moderate
Development Overhead Minimal High Moderate
Ideal Use Case Embedded/Local Games Large Applications Document Stores

Conclusion

SQLite is an optimal choice for an R-Type game database due to its simplicity, ease of integration, and performance characteristics suited for single-user environments. Its minimal setup requirements allow any developer to run the game seamlessly without extensive configuration, providing a smooth experience for end users and developers alike.

We decided to use the sqlite3 original package, available as sqlite3 on vcpkg, to use it on our C++ project.