perf: O(1) dedup/LMC cache, g_slist_append → prepend+reverse

- Add archive_ids hash set and stanza_senders hash map to
  ff_contact_state_t, populated during index build/extend via
  lightweight _ff_cache_line_ids() (no full parse overhead).
- Replace O(n) file scans in _ff_has_archive_id() and
  _ff_find_original_sender() with O(1) hash table lookups.
- Replace g_slist_append with g_slist_prepend + g_slist_reverse
  in _ff_apply_lmc, _flatfile_get_previous_chat, and
  ff_verify_integrity to avoid O(n²) list building.
- Add db_sqlite_last_changes() declaration to database.h.
This commit is contained in:
2026-03-12 10:14:51 +03:00
parent 06463b75b4
commit 71f9ab5007
6 changed files with 146 additions and 86 deletions

View File

@@ -92,6 +92,7 @@ GSList* db_sqlite_get_all_chat(const gchar* const contact_barejid);
void db_sqlite_begin_transaction(void);
void db_sqlite_end_transaction(void);
void db_sqlite_rollback_transaction(void);
int db_sqlite_last_changes(void);
#endif
db_backend_t* db_backend_flatfile(void);