mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-28 20:00:24 -07:00
[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:
parent
4bb8831531
commit
749223c2dc
31 changed files with 1604 additions and 106 deletions
|
|
@ -13,6 +13,22 @@ public:
|
|||
bool enabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Bundled per-set priority options, returned in a single call.
|
||||
*
|
||||
* Reading these individually (getSortKey/isEnabled/isKnown) is cheap for the
|
||||
* noop controller but extremely expensive when backed by QSettings, which
|
||||
* re-opens and re-parses the whole .ini on every access. Callers that need
|
||||
* more than one option for the same set (notably CardSet construction during
|
||||
* database load) should use getSetOptions() to avoid that cost.
|
||||
*/
|
||||
struct SetOptions
|
||||
{
|
||||
unsigned int sortKey = 0;
|
||||
bool enabled = false;
|
||||
bool isKnown = false;
|
||||
};
|
||||
|
||||
virtual ~ICardSetPriorityController() = default;
|
||||
|
||||
virtual void setSortKey(QString shortName, unsigned int sortKey) = 0;
|
||||
|
|
@ -23,6 +39,13 @@ public:
|
|||
virtual bool isEnabled(QString shortName) const = 0;
|
||||
virtual bool isKnown(QString shortName) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the bundled priority options for a set in a single call.
|
||||
* @param shortName The set's short name.
|
||||
* @return The sort key, enabled and known flags for the set.
|
||||
*/
|
||||
virtual SetOptions getSetOptions(QString shortName) const = 0;
|
||||
|
||||
virtual void saveSets(const QVector<SetSaveData> &data) = 0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
SetOptions getSetOptions(QString /* shortName */) const override
|
||||
{
|
||||
return {0, true, true};
|
||||
}
|
||||
|
||||
void saveSets(const QVector<SetSaveData> & /* data */) override
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue