Details
-
Type:
Suggestion
-
Status: Open
-
Priority:
P4: Low
-
Resolution: Unresolved
-
Affects Version/s: 5.9, 5.14.2
-
Fix Version/s: None
-
Component/s: Network: Sockets
-
Labels:
-
Platform/s:
Description
The Valgrind profiler shows that 71% of time in QAbstractSocket::waitForReadyRead() is spent for QNativeSocketEnginePrivate::setError() in case a timeout occurs.
I think it's quite a lot for a function that only sets the error code and name.
Measured code:
// Code in QThread::run() QEventLoop eventLoop; QTcpSocket *socket = new QTcpSocket(); // connect ... // wait for data ... while (!socket->waitForReadyRead(10)) { // wait 10 msecs // ... while (eventLoop.processEvents(QEventLoop::ExcludeSocketNotifiers)) { } } // read data ...