added wxString benchmark using 2.8's HTML parser

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-08-13 15:48:09 +00:00
parent 4c25eaccc9
commit c21faa0a3e
16 changed files with 2532 additions and 489 deletions

View File

@@ -9,8 +9,10 @@
/////////////////////////////////////////////////////////////////////////////
#include "wx/string.h"
#include "wx/ffile.h"
#include "bench.h"
#include "htmlparser/htmlpars.h"
static const char asciistr[] =
"This is just the first line of a very long 7 bit ASCII string"
@@ -273,3 +275,31 @@ BENCHMARK_FUNC(CharBuffer)
return wxStrlen(str.mb_str()) == ASCIISTR_LEN &&
wxStrlen(str.wc_str()) == ASCIISTR_LEN;
}
// ----------------------------------------------------------------------------
// wxString::operator[] - parse large HTML page
// ----------------------------------------------------------------------------
class DummyParser : public wx28HtmlParser
{
public:
virtual wxObject* GetProduct() { return NULL; }
virtual void AddText(const wxChar*) {}
};
BENCHMARK_FUNC(ParseHTML)
{
// static so that construction time is not counted
static DummyParser parser;
static wxString html;
if ( html.empty() )
{
wxFFile("htmltest.html").ReadAll(&html, wxConvUTF8);
}
parser.Parse(html);
return true;
}