From d0d592a35b7aa80b5778570366a627cf8a40ead8 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 26 Nov 2015 18:51:39 +0000 Subject: [PATCH] Speed up plugin condition evaluation Avoid unnecessary CRC calculation while evaluating conditions. --- src/backend/metadata/plugin_metadata.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/metadata/plugin_metadata.cpp b/src/backend/metadata/plugin_metadata.cpp index 718d56d5..36d5702e 100644 --- a/src/backend/metadata/plugin_metadata.cpp +++ b/src/backend/metadata/plugin_metadata.cpp @@ -296,8 +296,12 @@ namespace loot { ++it; } - //First need to get plugin's CRC, if it is an exact plugin and it does not have its CRC set. - if (!IsRegexPlugin()) { + // Regex plugins shouldn't have dirty info, but just clear in case. + if (IsRegexPlugin()) + _dirtyInfo.clear(); + + if (!_dirtyInfo.empty()) { + //First need to get plugin's CRC, if it is an exact plugin and it does not have its CRC set. uint32_t crc = game.GetCachedCrc(name); if (crc == 0) { if (boost::filesystem::exists(game.DataPath() / name)) { @@ -324,10 +328,6 @@ namespace loot { ++it; } } - else { - // Regex plugins shouldn't have dirty info, but just clear in case. - _dirtyInfo.clear(); - } return *this; }