summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2022-04-29 17:20:42 +0200
committerDavid Faure <david.faure@kdab.com>2022-05-10 15:20:57 +0200
commit3bc80195dfc683387ae438ad0bdfdd19b3adb037 (patch)
treee72384391ba9af43b163f1e6aae36d181e98aeb4 /tests/benchmarks
parentb51712f136a6dd0ee60e99b203a0cb14d9272538 (diff)
QWidgetTextControl: port to new-style connects (faster)
This speeds up creating a QGraphicsTextItem by 14% in an optimized build Before: 0.070 msecs per iteration After: 0.060 msecs per iteration Those connects were showing up when profiling, because of the string parsing that is necessary when using SIGNAL/SLOT macros. The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString() => QArgumentType constructor => qMetaTypeInternal(const char*). Pick-to: 6.3 6.2 5.15 Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 56b34fff2a..b9bbda766b 100644
--- a/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/benchmarks/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -57,6 +57,7 @@ private slots:
void scale();
void shear();
void translate();
+ void createTextItem();
};
tst_QGraphicsItem::tst_QGraphicsItem()
@@ -230,5 +231,15 @@ void tst_QGraphicsItem::translate()
}
}
+void tst_QGraphicsItem::createTextItem()
+{
+ // Ensure QFontDatabase loaded the font beforehand
+ QFontInfo(qApp->font()).family();
+ const QString text = "This is some text";
+ QBENCHMARK {
+ QGraphicsTextItem item(text);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"