summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMilian Wolff <milian.wolff@kdab.com>2013-12-28 15:43:09 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-08 15:04:34 +0100
commit2f7bef547e51ee6f2fe8f12bbe33f4978d6bd7f2 (patch)
treeb1699169a411ef7e013c97c8525745a9dd899b3a /tests
parent5354cb73e25afbdf55b78c29ca32c1b305aa7efe (diff)
downloadqtwebchannel-2f7bef547e51ee6f2fe8f12bbe33f4978d6bd7f2.tar.gz
Optimize: Use property-indices instead of names for notifications.
This reduces the traffic as the indices are usually much smaller than the property names. As such, the benchPropertyUpdates gets a speed boost of about 9% (or 10ms vs. 11ms). As we need to transmit the index during initialization that degrades its performance slightly by ca. 4% (13ms vs. 12.5ms). Considering that the initialization only takes place once whereas the property updates potentially often, this is a good tradeoff. Change-Id: If7df3e360f1528b7d7aa26c63ce851363ae9fd6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/webchannel/tst_webchannel.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/webchannel/tst_webchannel.cpp b/tests/webchannel/tst_webchannel.cpp
index 698b5e2..3b90744 100644
--- a/tests/webchannel/tst_webchannel.cpp
+++ b/tests/webchannel/tst_webchannel.cpp
@@ -164,6 +164,7 @@ void TestWebChannel::testInfoForObject()
QJsonArray expected;
{
QJsonArray property;
+ property.append(obj.metaObject()->indexOfProperty("objectName"));
property.append(QStringLiteral("objectName"));
{
QJsonArray signal;
@@ -176,6 +177,7 @@ void TestWebChannel::testInfoForObject()
}
{
QJsonArray property;
+ property.append(obj.metaObject()->indexOfProperty("foo"));
property.append(QStringLiteral("foo"));
{
QJsonArray signal;
@@ -186,6 +188,7 @@ void TestWebChannel::testInfoForObject()
}
{
QJsonArray property;
+ property.append(obj.metaObject()->indexOfProperty("asdf"));
property.append(QStringLiteral("asdf"));
{
QJsonArray signal;
@@ -198,6 +201,7 @@ void TestWebChannel::testInfoForObject()
}
{
QJsonArray property;
+ property.append(obj.metaObject()->indexOfProperty("bar"));
property.append(QStringLiteral("bar"));
{
QJsonArray signal;