Skip to content

Draft: feat: Implement Sqflite database

Krille-chan requested to merge krille/sqflite-database into main

First benchmarks:

  • Device: iOS Emulator
  • App: FluffyChat latest
  • Account with around 100 rooms on Synapse

Using sqflite_cipher and HiveCipher for encryption.

Initial Sync:

HiveCollectionsDatabase

flutter: [Matrix] Benchmark: Process sync -> 4942 ms (4300 items, 1.1493023255813954 ms/item)

SQFlite

flutter: [Matrix] Benchmark: Process sync -> 4733 ms (4304 items, 1.099674721189591 ms/item)

App Start:

HiveCollectionsDatabase

flutter: [Matrix] Benchmark: Get all account data from store -> 42 ms flutter: [Matrix] Benchmark: Get all user device keys from store -> 154 ms flutter: [Matrix] Benchmark: Get room list from store -> 710 ms

SQFlite

flutter: [Matrix] Benchmark: Get all account data from store -> 96 ms flutter: [Matrix] Benchmark: Get all user device keys from store -> 387 ms flutter: [Matrix] Benchmark: Get room list from store -> 490 ms

TODOS:

  • Implement POC FluffyChat implementation
  • Implement Database encryption
  • Implement encrypted file storage
  • Test on web
  • Implement transactions (should increase performance of initial sync by a lot)
  • Implement type adapters and get rid of inperformant row.toJson() and json.toRow() methods (should increase overall performance a little bit)
  • Investigate more performant sort_order solution (should increase performance of syncs)
Edited by Krille-chan

Merge request reports