Commit 648989da authored by Ulf Hermann's avatar Ulf Hermann
Browse files

QmlProfiler: Try to make the compiler inline event start comparison



This function is by a large margin the most often called one when
loading a trace. Passing it as a pointer to qSort certainly doesn't
help. Also, qSort is deprecated.

Task-number: QTCREATORBUG-11823
Change-Id: I98d744d1615733de93a8d35bccaa338643a2f6f4
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 84eadb01
......@@ -34,6 +34,7 @@
#include <utils/qtcassert.h>
#include <QUrl>
#include <QDebug>
#include <algorithm>
namespace QmlProfiler {
......@@ -105,11 +106,6 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventData &event)
}
bool compareStartTimes(const QmlProfilerDataModel::QmlEventData &t1, const QmlProfilerDataModel::QmlEventData &t2)
{
return t1.startTime < t2.startTime;
}
//////////////////////////////////////////////////////////////////////////////
QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder,
......@@ -147,13 +143,19 @@ bool QmlProfilerDataModel::isEmpty() const
return d->eventList.isEmpty();
}
inline static bool operator<(const QmlProfilerDataModel::QmlEventData &t1,
const QmlProfilerDataModel::QmlEventData &t2)
{
return t1.startTime < t2.startTime;
}
void QmlProfilerDataModel::complete()
{
Q_D(QmlProfilerDataModel);
// post-processing
// sort events by start time
qSort(d->eventList.begin(), d->eventList.end(), compareStartTimes);
// sort events by start time, using above operator<
std::sort(d->eventList.begin(), d->eventList.end());
// rewrite strings
int n = d->eventList.count();
......
Supports Markdown
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