[Card Database] Improve loading times through binary cache (#7051)

* [Card Database] Improve loading times through binary cache

Took 10 minutes


Took 9 minutes

Took 16 seconds

* [Card Database] Remove lib qt include

Took 18 minutes


Took 14 seconds

* Downgrade to 6.3 datastream

Took 5 minutes

* go up to 6.4 datastream

Took 1 minute

* Address comments

* Small bug fixes

Took 20 minutes


Took 10 seconds

* More fixes.

Took 4 minutes


Took 4 seconds

* Even more fixes.

Took 11 minutes


Took 4 seconds

* More fixes.

Took 6 minutes

Took 26 seconds

Took 8 minutes

* Namespace instead of class

Took 6 minutes

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-07-27 23:12:53 +02:00 committed by GitHub
parent 4bb8831531
commit 749223c2dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 1604 additions and 106 deletions

View file

@ -541,6 +541,12 @@ MainWindow::MainWindow(QWidget *parent)
void MainWindow::startupConfigCheck()
{
// checkUnknownSets() is intentionally deferred from the card database load
// (which runs in main() before MainWindow exists) so that
// cardDatabaseNewSetsFound / cardDatabaseAllNewSetsEnabled have live
// receivers when emitted.
CardDatabaseManager::getInstance()->checkUnknownSets();
if (SettingsCache::instance().debug().getLocalGameOnStartup()) {
LocalGameOptions options;
options.numberPlayers = SettingsCache::instance().debug().getLocalGamePlayerCount();
@ -571,8 +577,6 @@ void MainWindow::startupConfigCheck()
<< "differs, assuming first start after update";
if (SettingsCache::instance().updates().getNotifyAboutNewVersion()) {
alertForcedOracleRun(VERSION_STRING, true);
} else {
const auto reloadOk0 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
}
qCInfo(WindowMainStartupShortcutsLog) << "Migrating shortcuts after update detected.";
@ -629,8 +633,6 @@ void MainWindow::startupConfigCheck()
}
}
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
// Run the tips dialog only on subsequent startups.
// On the first run after an install/update the startup is already crowded enough
if (tip->successfulInit && SettingsCache::instance().personal().getShowTipsOnStartup() &&

View file

@ -258,6 +258,19 @@ int main(int argc, char *argv[])
qCInfo(MainLog) << "Starting main program";
// Front-load the card database before constructing the main window. The
// binary-cache read is cheap when uncontended (~1s); doing it here -- while no
// GUI work yet competes for CPU -- avoids the multi-second, GUI-freezing
// contention that happens when the load runs alongside window construction.
// The CardDatabaseModel populates from the already-loaded data in its
// constructor, so the window appears fully populated with no startup lag.
// Note: checkUnknownSets() is deferred from the initial load to
// MainWindow::startupConfigCheck() so that
// cardDatabaseNewSetsFound / cardDatabaseAllNewSetsEnabled have live
// receivers when emitted. Subsequent reloads (e.g. path changes) call
// checkUnknownSets() directly from the loader after the first load.
CardDatabaseManager::getInstance()->loadCardDatabases();
MainWindow ui;
if (parser.isSet("connect")) {
ui.setConnectTo(parser.value("connect"));