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

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

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.9, 5.14.2
    • Network: Sockets
    • 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

            cnn Qt Core & Network
            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