summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Goetz <Markus.Goetz@nokia.com>2009-11-27 09:55:56 (GMT)
committerMarkus Goetz <Markus.Goetz@nokia.com>2009-11-27 09:56:19 (GMT)
commitef17dac74688a8754aa4434a24ddb19d2ab4dcc5 (patch)
tree4d2a0a65e091873581fbc7b1894151373d0d4bb9
parentc8de2b42348eb8665bee3948895c397c4a364251 (diff)
downloadQt-ef17dac74688a8754aa4434a24ddb19d2ab4dcc5.zip
Qt-ef17dac74688a8754aa4434a24ddb19d2ab4dcc5.tar.gz
Qt-ef17dac74688a8754aa4434a24ddb19d2ab4dcc5.tar.bz2
Improve QFileInfo benchmark
Reviewed-by: TrustMe
-rw-r--r--src/corelib/io/qfsfileengine_p.h2
-rw-r--r--tests/benchmarks/qfileinfo/main.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index 87f0737..41a6a1b 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
#define Q_USE_DEPRECATED_MAP_API 1
#endif
-class QFSFileEnginePrivate : public QAbstractFileEnginePrivate
+class Q_AUTOTEST_EXPORT QFSFileEnginePrivate : public QAbstractFileEnginePrivate
{
Q_DECLARE_PUBLIC(QFSFileEngine)
diff --git a/tests/benchmarks/qfileinfo/main.cpp b/tests/benchmarks/qfileinfo/main.cpp
index 7950f58..711209c 100644
--- a/tests/benchmarks/qfileinfo/main.cpp
+++ b/tests/benchmarks/qfileinfo/main.cpp
@@ -44,6 +44,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QFileInfo>
+#include "private/qfsfileengine_p.h"
class qfileinfo : public QObject
{
@@ -67,11 +68,12 @@ void qfileinfo::cleanupTestCase()
void qfileinfo::canonicalFileNamePerformance()
{
+ QString appPath = QCoreApplication::applicationFilePath();
+ QFSFileEnginePrivate::canonicalized(appPath); // warmup
+ QFSFileEnginePrivate::canonicalized(appPath); // more warmup
QBENCHMARK {
for (int i = 0; i < 5000; i++) {
- // this actually calls canonicalFilePath twice, once inside QCoreApplication.
- QFileInfo fi(QCoreApplication::applicationFilePath());
- fi.canonicalFilePath();
+ QFSFileEnginePrivate::canonicalized(appPath);
}
}
}