From 2516fc935cfa77bd42e9cededf7e8be8c0980e13 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Thu, 22 Oct 2020 11:39:34 +0200 Subject: [PATCH] Add benchmark for QString::number(int) Add a almost trivial benchmark for QString::number(int). Change-Id: Ice67eaf28e8d7b235fd5ec5e0b87b3b9053ae61e Reviewed-by: Karsten Heimrich Reviewed-by: Edward Welbourne --- tests/benchmarks/corelib/text/qlocale/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/benchmarks/corelib/text/qlocale/main.cpp b/tests/benchmarks/corelib/text/qlocale/main.cpp index 7047338800..7f6eeae993 100644 --- a/tests/benchmarks/corelib/text/qlocale/main.cpp +++ b/tests/benchmarks/corelib/text/qlocale/main.cpp @@ -37,6 +37,7 @@ private Q_SLOTS: void toUpper_QLocale_1(); void toUpper_QLocale_2(); void toUpper_QString(); + void number_QString(); }; static QString data() @@ -66,6 +67,14 @@ void tst_QLocale::toUpper_QString() QBENCHMARK { LOOP(QString t(s.toUpper())) } } +void tst_QLocale::number_QString() +{ + QString s; + QBENCHMARK { + s = QString::number(12345678); + } +} + QTEST_MAIN(tst_QLocale) #include "main.moc"