forked from qt-creator/qt-creator
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: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user