impr: Optimize time it takes to find favorites in patterns
This commit is contained in:
parent
5ca3222e5b
commit
416889f49d
@ -1382,6 +1382,8 @@ namespace hex::ui {
|
||||
|
||||
for (auto &pattern : patterns) {
|
||||
std::vector<std::string> patternPath;
|
||||
|
||||
size_t startFavoriteCount = m_favorites.size();
|
||||
traversePatternTree(*pattern, patternPath, [&, this](const pl::ptrn::Pattern &currPattern) {
|
||||
if (currPattern.hasAttribute("hex::favorite"))
|
||||
m_favorites.insert({ patternPath, currPattern.clone() });
|
||||
@ -1394,12 +1396,15 @@ namespace hex::ui {
|
||||
|
||||
m_groups[groupName].push_back(currPattern.clone());
|
||||
}
|
||||
|
||||
task.update();
|
||||
});
|
||||
|
||||
if (updatedFavorites == m_favorites.size())
|
||||
task.interrupt();
|
||||
task.update();
|
||||
|
||||
if (startFavoriteCount == m_favorites.size())
|
||||
continue;
|
||||
|
||||
patternPath.clear();
|
||||
traversePatternTree(*pattern, patternPath, [&, this](const pl::ptrn::Pattern &currPattern) {
|
||||
for (auto &[path, favoritePattern] : m_favorites) {
|
||||
|
Loading…
Reference in New Issue
Block a user