From 3ef0db4cca1971ed1552c0314e0039dac792d2e5 Mon Sep 17 00:00:00 2001 From: RJ <122295667+Liderate@users.noreply.github.com> Date: Fri, 23 May 2025 03:15:43 -0400 Subject: Speedup refresh when archive parsing is enabled and updateBSAList (#2239) * Precompute load order for ModThreads * Precompute file infos for plugin association check --------- Co-authored-by: RJ --- src/mainwindow.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bdc40f68..c8847534 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1919,12 +1919,18 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives, fileName.endsWith(".esl", Qt::CaseInsensitive); }); + QList> pluginNamePairs; + pluginNamePairs.reserve(plugins.size()); + for (const QString& pluginName : plugins) { + QFileInfo pluginInfo(pluginName); + pluginNamePairs.append( + std::make_pair(pluginInfo.completeBaseName(), pluginInfo.fileName())); + } + auto hasAssociatedPlugin = [&](const QString& bsaName) -> bool { - for (const QString& pluginName : plugins) { - QFileInfo pluginInfo(pluginName); - if (bsaName.startsWith(QFileInfo(pluginName).completeBaseName(), - Qt::CaseInsensitive) && - (m_OrganizerCore.pluginList()->state(pluginInfo.fileName()) == + for (const auto& [completeBaseName, fileName] : pluginNamePairs) { + if (bsaName.startsWith(completeBaseName, Qt::CaseInsensitive) && + (m_OrganizerCore.pluginList()->state(fileName) == IPluginList::STATE_ACTIVE)) { return true; } -- cgit v1.3.1