Kaydet (Commit) 7f7e890a authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Noel Grandin

sd: micro-optimize SdPage::GetPresObj() by sorting less

No need to sort all matched elements.

Change-Id: I4133b28a9c84ab322e55f9987859690e426f600c
Reviewed-on: https://gerrit.libreoffice.org/59691
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 2fbb9736
......@@ -232,16 +232,16 @@ SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearc
}
}
if( aMatches.size() > 1 )
{
std::sort( aMatches.begin(), aMatches.end(), OrdNumSorter() );
}
if( nIndex > 0 )
nIndex--;
if( (nIndex >= 0) && ( aMatches.size() > static_cast<unsigned int>(nIndex)) )
{
if( aMatches.size() > 1 )
std::nth_element( aMatches.begin(), aMatches.begin() + nIndex, aMatches.end(),
OrdNumSorter() );
return aMatches[nIndex];
}
return nullptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment