From 2f7bef547e51ee6f2fe8f12bbe33f4978d6bd7f2 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Sat, 28 Dec 2013 15:43:09 +0100 Subject: 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 --- tests/webchannel/tst_webchannel.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') 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; -- cgit v1.2.1