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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user