Slightly improve MClass::GetMethod method iteration

Check the number of parameters first before expensive string comparison
This commit is contained in:
2023-08-13 14:24:48 +03:00
parent 09be2375f6
commit 27e1401fc7

View File

@@ -878,7 +878,7 @@ MMethod* MClass::GetMethod(const char* name, int32 numParams) const
GetMethods();
for (int32 i = 0; i < _methods.Count(); i++)
{
if (_methods[i]->GetName() == name && _methods[i]->GetParametersCount() == numParams)
if (_methods[i]->GetParametersCount() == numParams && _methods[i]->GetName() == name)
return _methods[i];
}
return nullptr;