mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Return a cached reference from PluginSortingData::GetName()
Avoiding the string copies improves sorting performance by 7%.
This commit is contained in:
@@ -59,6 +59,7 @@ PluginSortingData::PluginSortingData(
|
||||
const std::vector<std::string>& loadOrder) :
|
||||
#endif
|
||||
plugin_(plugin),
|
||||
name_(plugin == nullptr ? std::string() : plugin->GetName()),
|
||||
group_(userMetadata.GetGroup().value_or(
|
||||
masterlistMetadata.GetGroup().value_or(Group::DEFAULT_NAME))),
|
||||
masterlistLoadAfter_(masterlistMetadata.GetLoadAfterFiles()),
|
||||
@@ -89,7 +90,7 @@ PluginSortingData::PluginSortingData(
|
||||
overrideRecordCount_ = plugin->GetOverrideRecordCount();
|
||||
}
|
||||
|
||||
std::string PluginSortingData::GetName() const { return plugin_->GetName(); }
|
||||
const std::string& PluginSortingData::GetName() const { return name_; }
|
||||
|
||||
bool PluginSortingData::IsMaster() const {
|
||||
return plugin_ != nullptr && plugin_->IsMaster();
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
const std::vector<std::string>& loadOrder);
|
||||
#endif
|
||||
|
||||
std::string GetName() const;
|
||||
const std::string& GetName() const;
|
||||
bool IsMaster() const;
|
||||
bool IsBlueprintMaster() const;
|
||||
bool LoadsArchive() const;
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
|
||||
private:
|
||||
const PluginSortingInterface* plugin_{nullptr};
|
||||
std::string name_;
|
||||
std::string group_;
|
||||
|
||||
std::vector<File> masterlistLoadAfter_;
|
||||
|
||||
Reference in New Issue
Block a user