Reduce amount of copies for HashedString for improved performance
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <deukhoofd@gmail.com>
This commit is contained in:
2019-06-25 15:18:36 +02:00
parent bace7b294d
commit 48224afe45
13 changed files with 62 additions and 57 deletions

View File

@@ -67,11 +67,11 @@ void Porygon::Script::Parse(const u16string& script) {
}
EvalValue *Porygon::Script::GetVariable(const u16string &key) {
return _scriptVariables -> at(HashedString(key)).get();
return _scriptVariables -> at(HashedString::CreateLookup(key)).get();
}
bool Porygon::Script::HasVariable(const u16string &key) {
auto f = _scriptVariables->find(HashedString(key));
auto f = _scriptVariables->find(HashedString::CreateLookup(key));
return f != _scriptVariables->end();
}
@@ -80,7 +80,7 @@ EvalValue *Porygon::Script::GetLastValue() {
}
bool Porygon::Script::HasFunction(const u16string &key) {
auto f = _scriptVariables->find(HashedString(key));
auto f = _scriptVariables->find(HashedString::CreateLookup(key));
return f != _scriptVariables->end() && f.operator->()->second->GetTypeClass() == TypeClass ::Function;
}