optimize Replace() to use a linear algorithm (closes #9135)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59420 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-03-07 16:07:58 +00:00
parent 101b242093
commit 072682ce44
4 changed files with 70 additions and 20 deletions

View File

@@ -281,6 +281,18 @@ BENCHMARK_FUNC(ReplaceAll)
return str.Replace("x", "y") != 0;
}
BENCHMARK_FUNC(ReplaceLonger)
{
wxString str('x', ASCIISTR_LEN);
return str.Replace("x", "yy") != 0;
}
BENCHMARK_FUNC(ReplaceShorter)
{
wxString str('x', ASCIISTR_LEN);
return str.Replace("xx", "y") != 0;
}
// ----------------------------------------------------------------------------
// string buffers: wx[W]CharBuffer