Commit 66e9cb0a authored by Eike Ziller's avatar Eike Ziller Committed by Eike Ziller

Xcodebuild parser: Improve performance

QRegExp is extremely ineffecient when capturing everything at the start,
but not matching the end of the expression (e.g. 200+ms when parsing for
signature change message in the relatively long xcodebuild compile
output line).
QRegularExpression is much faster with the same expression (40ms with
the same example), but just checking for "endsWith" and getting the
first part of the line manually is the fastest.

Change-Id: Id5f0378e38f0edeba24036c6e9519c8107e4a361
Task-number: QTCREATORBUG-15613
Reviewed-by: default avatarVikas Pachdha <vikas.pachdha@theqtcompany.com>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 05ae44dc
......@@ -37,7 +37,7 @@ namespace ProjectExplorer {
static const char failureRe[] = "\\*\\* BUILD FAILED \\*\\*$";
static const char successRe[] = "\\*\\* BUILD SUCCEEDED \\*\\*$";
static const char buildRe[] = "=== BUILD (AGGREGATE )?TARGET (.*) OF PROJECT (.*) WITH .* ===$";
static const char signatureChangeRe[] = "(.+): replacing existing signature$";
static const char signatureChangeEndsWithPattern[] = ": replacing existing signature";
XcodebuildParser::XcodebuildParser() :
m_fatalErrorCount(0),
......@@ -50,8 +50,6 @@ XcodebuildParser::XcodebuildParser() :
QTC_CHECK(m_successRe.isValid());
m_buildRe.setPattern(QLatin1String(buildRe));
QTC_CHECK(m_buildRe.isValid());
m_replacingSignatureRe.setPattern(QLatin1String(signatureChangeRe));
QTC_CHECK(m_replacingSignatureRe.isValid());
}
bool XcodebuildParser::hasFatalErrors() const
......@@ -73,11 +71,12 @@ void XcodebuildParser::stdOutput(const QString &line)
m_xcodeBuildParserState = OutsideXcodebuild;
return;
}
if (m_replacingSignatureRe.indexIn(lne) > -1) {
if (lne.endsWith(QLatin1String(signatureChangeEndsWithPattern))) {
Task task(Task::Warning,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Replacing signature"),
Utils::FileName::fromString(m_replacingSignatureRe.cap(1)), /* filename */
Utils::FileName::fromString(
lne.left(lne.size() - QLatin1String(signatureChangeEndsWithPattern).size())), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
taskAdded(task, 1);
......
......@@ -55,7 +55,6 @@ private:
QRegExp m_failureRe;
QRegExp m_successRe;
QRegExp m_buildRe;
QRegExp m_replacingSignatureRe;
XcodebuildStatus m_xcodeBuildParserState;
QString m_lastTarget;
QString m_lastProject;
......
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