diff options
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qdir/tst_qdir.cpp | 37 | ||||
-rw-r--r-- | tests/benchmarks/qscriptengine/tst_qscriptengine.cpp | 21 |
2 files changed, 57 insertions, 1 deletions
diff --git a/tests/benchmarks/qdir/tst_qdir.cpp b/tests/benchmarks/qdir/tst_qdir.cpp index fd558d3..64c6ba1 100644 --- a/tests/benchmarks/qdir/tst_qdir.cpp +++ b/tests/benchmarks/qdir/tst_qdir.cpp @@ -78,6 +78,8 @@ public slots: temp.rmdir(QLatin1String("test_speed")); } private slots: + void baseline() {} + void sizeSpeed() { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { @@ -88,6 +90,18 @@ private slots: } } } + void sizeSpeedIterator() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QDirIterator dit(testdir.path(), QDir::Files); + while (dit.hasNext()) { + dit.fileInfo().isDir(); + dit.fileInfo().size(); + dit.next(); + } + } + } + void sizeSpeedWithoutFilter() { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { @@ -97,6 +111,18 @@ private slots: } } } + void sizeSpeedWithoutFilterIterator() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); + QBENCHMARK { + QDirIterator dit(testdir.path()); + while (dit.hasNext()) { + dit.fileInfo().isDir(); + dit.fileInfo().size(); + dit.next(); + } + } + } + void sizeSpeedWithoutFileInfoList() { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Unsorted); @@ -108,6 +134,7 @@ private slots: } } } + void iDontWantAnyStat() { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Unsorted); @@ -119,8 +146,16 @@ private slots: } } } + void iDontWantAnyStatIterator() { + QBENCHMARK { + QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed")); + while (dit.hasNext()) { + dit.next(); + } + } + } - void testLowLevel() { + void sizeSpeedWithoutFilterLowLevel() { #ifdef Q_OS_WIN const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); wchar_t appendedPath[MAX_PATH]; diff --git a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp index 8d5f6e6..1c787e9 100644 --- a/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp +++ b/tests/benchmarks/qscriptengine/tst_qscriptengine.cpp @@ -72,6 +72,8 @@ private slots: void toStringHandle(); void castValueToQreal(); void nativeCall(); + void translation_data(); + void translation(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -259,5 +261,24 @@ void tst_QScriptEngine::nativeCall() } } +void tst_QScriptEngine::translation_data() +{ + QTest::addColumn<QString>("text"); + QTest::newRow("no translation") << "\"hello world\""; + QTest::newRow("qsTr") << "qsTr(\"hello world\")"; + QTest::newRow("qsTranslate") << "qsTranslate(\"\", \"hello world\")"; +} + +void tst_QScriptEngine::translation() +{ + QFETCH(QString, text); + QScriptEngine engine; + engine.installTranslatorFunctions(); + + QBENCHMARK { + (void)engine.evaluate(text); + } +} + QTEST_MAIN(tst_QScriptEngine) #include "tst_qscriptengine.moc" |