Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-84333

QAbstractSocket::waitForReadyRead() slow because of setError()

    XMLWordPrintable

    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:
      Linux/X11

      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 ...
      
      
      

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            cnn Qt Core & Network
            Reporter:
            amiart Robert Szefner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes