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 <utils/qtcassert.h>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
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,
|
QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder,
|
||||||
@@ -147,13 +143,19 @@ bool QmlProfilerDataModel::isEmpty() const
|
|||||||
return d->eventList.isEmpty();
|
return d->eventList.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static bool operator<(const QmlProfilerDataModel::QmlEventData &t1,
|
||||||
|
const QmlProfilerDataModel::QmlEventData &t2)
|
||||||
|
{
|
||||||
|
return t1.startTime < t2.startTime;
|
||||||
|
}
|
||||||
|
|
||||||
void QmlProfilerDataModel::complete()
|
void QmlProfilerDataModel::complete()
|
||||||
{
|
{
|
||||||
Q_D(QmlProfilerDataModel);
|
Q_D(QmlProfilerDataModel);
|
||||||
// post-processing
|
// post-processing
|
||||||
|
|
||||||
// sort events by start time
|
// sort events by start time, using above operator<
|
||||||
qSort(d->eventList.begin(), d->eventList.end(), compareStartTimes);
|
std::sort(d->eventList.begin(), d->eventList.end());
|
||||||
|
|
||||||
// rewrite strings
|
// rewrite strings
|
||||||
int n = d->eventList.count();
|
int n = d->eventList.count();
|
||||||
|
|||||||
Reference in New Issue
Block a user