From 9ca9de7cbc8b045c19899987d6666576399af33d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 3 Mar 2016 11:25:27 +0100 Subject: QmlDebug: Support sending multiple messages per packet This reduces the overhead caused by the prepending of service names to packets. When running the planets example from qtcanvas3d through qmlprofiler the average message length, without service name, is 26 bytes. The average full packet, with name and length, is 64 bytes long. In fact, the time between stopping the application and the last message arriving in the profiling client is reduced by 30-50% with this change. Change-Id: I0ffdd0483d45bbe8b092c59a9dcd63c6dc59119c Reviewed-by: Simon Hausmann --- src/qmldebug/qqmldebugconnection.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/qmldebug') diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp index 37b66889cd..35a540bff8 100644 --- a/src/qmldebug/qqmldebugconnection.cpp +++ b/src/qmldebug/qqmldebugconnection.cpp @@ -106,7 +106,8 @@ void QQmlDebugConnection::socketConnected() { Q_D(QQmlDebugConnection); QPacket pack(d->currentDataStreamVersion); - pack << serverId << 0 << protocolVersion << d->plugins.keys() << d->maximumDataStreamVersion; + pack << serverId << 0 << protocolVersion << d->plugins.keys() << d->maximumDataStreamVersion + << true; // We accept multiple messages per packet d->protocol->send(pack.data()); d->flush(); } @@ -221,9 +222,6 @@ void QQmlDebugConnection::protocolReadyRead() qWarning() << "QQmlDebugConnection: Unknown control message id" << op; } } else { - QByteArray message; - pack >> message; - QHash::Iterator iter = d->plugins.find(name); if (iter == d->plugins.end()) { // We can get more messages for plugins we have removed because it takes time to @@ -232,7 +230,12 @@ void QQmlDebugConnection::protocolReadyRead() qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name; } else { - (*iter)->messageReceived(message); + QQmlDebugClient *client = *iter; + QByteArray message; + while (!pack.atEnd()) { + pack >> message; + client->messageReceived(message); + } } } } -- cgit v1.2.3