High CPU consumption with QTcpSocket::waitForReadyRead on OSX?



  • Update: This isn't a problem with waitForReadyRead but rather with QProgressBar. I've added more info in my next post.

    Hi there,

    I have a file sharing client application written with Qt that I build on both Windows and OSX. I've just now noticed that when downloading on OSX, CPU consumption is quite high (around % 30 CPU per active download in Activity Meter), whereas on Windows CPU consumption for the client is very low at all times. Each download is handled in a separate QThread to which the socket is moved using moveToThread (preceded by setParent(0) to enable the move), and waitForReadyRead is used whenever bytesAvailable() returns 0. I tried eliminating virtually all other activity in the thread to see if anything else might be causing this consumption, but it certainly seems as if waitForReadyRead is the culprit. Is this normal for OSX? Is there anything I might be able to do to improve on this?

    Thanks, Nir



  • So this appears to have nothing to do with waitForReadyRead. CPU consumption whenever the download's QProgress bar is in view and active (animated) goes way up. This is true regardless of how frequently I update it. Googling for QProgressBar and CPU comes up with a lot of relevant information, including this bug report from 2011:

    https://bugreports.qt-project.org/browse/QTBUG-20880

    I guess it was never fixed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.