summaryrefslogtreecommitdiffstats
path: root/tests/auto/other/lancelot/paintcommands.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-03-23 11:09:18 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-04-04 08:17:43 +0000
commit559964849af0d2dfcb409169dcc9e40d01c6fae2 (patch)
tree26618cb3ee706c237827c55d3c8f55bd862af95a /tests/auto/other/lancelot/paintcommands.cpp
parent3e1ecdd74cfb85d1c73f96289fc2114708881c6b (diff)
Add lancelot based benchmark
Uses the scripts and tests we already have for lancelot as a painting benchmark. Change-Id: Idf8a55e2261162e619f6dbb567dc19f8dc96da4e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto/other/lancelot/paintcommands.cpp')
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index 4e0cb3b835..074644393d 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -192,7 +192,7 @@ QList<QPair<QString,QStringList> > PaintCommands::s_enumsTable = QList<QPair<QSt
QMultiHash<QString, int> PaintCommands::s_commandHash;
#define DECL_PAINTCOMMAND(identifier, method, regexp, syntax, sample) \
- s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp, QRegularExpression::OptimizeOnFirstUsageOption), \
+ s_commandInfoTable << PaintCommandInfos(QLatin1String(identifier), &PaintCommands::method, QRegularExpression(regexp), \
QLatin1String(syntax), QLatin1String(sample) );
#define DECL_PAINTCOMMANDSECTION(title) \
@@ -615,6 +615,8 @@ void PaintCommands::staticInit()
// populate the command lookup hash
for (int i=0; i<s_commandInfoTable.size(); i++) {
+ // and pre-optimize the regexps.
+ s_commandInfoTable.at(i).regExp.optimize();
if (s_commandInfoTable.at(i).isSectionHeader() ||
s_commandInfoTable.at(i).identifier == QLatin1String("comment") ||
s_commandInfoTable.at(i).identifier == QLatin1String("noop"))
@@ -682,6 +684,7 @@ void PaintCommands::insertAt(int commandIndex, const QStringList &newCommands)
**********************************************************************************/
void PaintCommands::runCommand(const QString &scriptLine)
{
+ static QRegularExpression separators("\\s");
if (scriptLine.isEmpty()) {
command_noop(QRegularExpressionMatch());
return;
@@ -690,7 +693,7 @@ void PaintCommands::runCommand(const QString &scriptLine)
command_comment(QRegularExpressionMatch());
return;
}
- QString firstWord = scriptLine.section(QRegularExpression("\\s"), 0, 0);
+ QString firstWord = scriptLine.section(separators, 0, 0);
QList<int> indices = s_commandHash.values(firstWord);
foreach(int idx, indices) {
PaintCommandInfos command = s_commandInfoTable.at(idx);