impr: Optimization for searching for favorite and group patterns
This commit is contained in:
parent
fe9eecd031
commit
d167e43252
2
lib/external/pattern_language
vendored
2
lib/external/pattern_language
vendored
@ -1 +1 @@
|
||||
Subproject commit f9eed4b7ad1f6f50f25f9fd4222be325885e8c4e
|
||||
Subproject commit 9a02bd862fc8a4768a152a31a0175145fc48b0a2
|
@ -1392,15 +1392,17 @@ namespace hex::ui {
|
||||
m_favoritesUpdateTask = TaskManager::createTask("hex.ui.pattern_drawer.updating"_lang, TaskManager::NoProgress, [this, patterns](auto &task) {
|
||||
size_t updatedFavorites = 0;
|
||||
|
||||
const std::string favoriteAttribute = "hex::favorite";
|
||||
const std::string groupAttribute = "hex::group";
|
||||
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"))
|
||||
if (currPattern.hasAttribute(favoriteAttribute))
|
||||
m_favorites.insert({ patternPath, currPattern.clone() });
|
||||
|
||||
if (const auto &args = currPattern.getAttributeArguments("hex::group"); !args.empty()) {
|
||||
if (const auto &args = currPattern.getAttributeArguments(groupAttribute); !args.empty()) {
|
||||
auto groupName = args.front().toString();
|
||||
|
||||
if (!m_groups.contains(groupName))
|
||||
|
Loading…
Reference in New Issue
Block a user