Speed up finding message catalog by name in wxTranslations.
Use a helper hash map to allow efficiently finding message catalogs by name instead of using linear search in a linked list which can be noticeably slow when many catalogs are used. This speeds up wxGetTranslation() when the domain is specified. Closes #16975.
This commit is contained in:
committed by
Vadim Zeitlin
parent
d1de0f3038
commit
97286e13bd
@@ -183,6 +183,12 @@ private:
|
||||
wxTranslationsLoader *m_loader;
|
||||
|
||||
wxMsgCatalog *m_pMsgCat; // pointer to linked list of catalogs
|
||||
|
||||
// In addition to keeping all the catalogs in the linked list, we also
|
||||
// store them in a hash map indexed by the domain name to allow finding
|
||||
// them by name efficiently.
|
||||
WX_DECLARE_HASH_MAP(wxString, wxMsgCatalog *, wxStringHash, wxStringEqual, wxMsgCatalogMap);
|
||||
wxMsgCatalogMap m_catalogMap;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user