From 3b3959198c05b4ec35671b110902a07a05a802f2 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Thu, 11 Aug 2016 12:24:48 +0300 Subject: SplineEditor: replace QList with QVector There are only appending operations, and QList is optimized for types with sizeof(void*), so storing qreal or QPointF in QList is inefficient. Change-Id: Ic2f216fa81549bfb8790c6ff58dd6053c776c297 Reviewed-by: Simon Hausmann --- tools/qmleasing/splineeditor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/qmleasing') diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index 78ed9606db..ab22d579f8 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -34,6 +34,7 @@ #include #include #include +#include const int canvasWidth = 640; const int canvasHeight = 320; @@ -677,7 +678,7 @@ void SplineEditor::setEasingCurve(const QString &code) cleanCode.chop(1); const QStringList stringList = cleanCode.split(QLatin1Char(','), QString::SkipEmptyParts); if (stringList.count() >= 6 && (stringList.count() % 6 == 0)) { - QList realList; + QVector realList; realList.reserve(stringList.count()); foreach (const QString &string, stringList) { bool ok; @@ -685,12 +686,12 @@ void SplineEditor::setEasingCurve(const QString &code) if (!ok) return; } - QList points; + QVector points; const int count = realList.count() / 2; points.reserve(count); for (int i = 0; i < count; ++i) points.append(QPointF(realList.at(i * 2), realList.at(i * 2 + 1))); - if (points.last() == QPointF(1.0, 1.0)) { + if (points.constLast() == QPointF(1.0, 1.0)) { QEasingCurve easingCurve(QEasingCurve::BezierSpline); for (int i = 0; i < points.count() / 3; ++i) { -- cgit v1.2.3