summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-02-25 10:33:31 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-02-25 10:33:31 (GMT)
commitf446c5c356f3f805e988eef41edb4acbdb2fb5fc (patch)
tree862ad9003e6a24cd035ad70174d8162cb7d3ee65
parent981b7c1be2e0316c326b8e8485855c8d1812b8cc (diff)
downloadQt-f446c5c356f3f805e988eef41edb4acbdb2fb5fc.zip
Qt-f446c5c356f3f805e988eef41edb4acbdb2fb5fc.tar.gz
Qt-f446c5c356f3f805e988eef41edb4acbdb2fb5fc.tar.bz2
Add benchmarks for accessing meta-object properties via QScriptValue
Reviewed-by: Benjamin Poulain
-rw-r--r--tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp
index 3bfc21c..d7bb04b 100644
--- a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp
@@ -69,6 +69,8 @@ private slots:
void property();
void setProperty();
void propertyFlags();
+ void readMetaProperty();
+ void writeMetaProperty();
};
tst_QScriptValue::tst_QScriptValue()
@@ -201,5 +203,28 @@ void tst_QScriptValue::propertyFlags()
}
}
+void tst_QScriptValue::readMetaProperty()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newQObject(QCoreApplication::instance());
+ QScriptString propertyName = engine.toStringHandle("objectName");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.property(propertyName);
+ }
+}
+
+void tst_QScriptValue::writeMetaProperty()
+{
+ QScriptEngine engine;
+ QScriptValue object = engine.newQObject(QCoreApplication::instance());
+ QScriptString propertyName = engine.toStringHandle("objectName");
+ QScriptValue value(&engine, "foo");
+ QBENCHMARK {
+ for (int i = 0; i < 10000; ++i)
+ object.setProperty(propertyName, value);
+ }
+}
+
QTEST_MAIN(tst_QScriptValue)
#include "tst_qscriptvalue.moc"