Results 1 to 11 of 11

Thread: [SOLVED] Piping to QProcess very slow performance

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Posts
    70
    Thanks
    43
    Thanked 4 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default [SOLVED] Piping to QProcess very slow performance

    I have an external compression application that can run independently or piped via stdin. I would like to implement the piping option to take advantage of the performance benefits of avoiding writing to disk twice. My data is a binary stream of several MB, often a few GB.

    I have implemented this using QProcess, launching the executable in QIODevice::ReadWrite mode with the appropriate arguments using QProcess::start(). My data is then output using a QDataStream attached to my QProcess. I don't have access to the outside application's source code, but other implementations have done this succesfully using libraries other than Qt.

    Two things. First, no data actually appears to transfer until I have my application sit around waiting for the QProcess to finish. How do I force a flush of QProcess?

    Second, when the actual data transfer between processes occurs, it is incredibly slow. The transfer rate appears to be around 400KB/s. When I compress a file in stand-alone mode, it takes approximately 1.369secs to run a 68MB file, so I know that the compression itself is relatively fast. The same file, when piped, takes approximately 170 seconds, and the CPU reports a 0% load on either process.

    I suspect that the slow performance has something to do with the fact that QProcess is optimized for basic text communication between processes (very small buffers), not for huge data transfers, but I see no way to change the buffer size for QProcess so that I can test this theory.

    I'm developing and running on Windows 7 64bit Pro, using MSVC2010.
    Last edited by Phlucious; 19th March 2013 at 23:40. Reason: question was resolved

  2. #2
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Piping to QProcess very slow performance

    First, no data actually appears to transfer until I have my application sit around waiting for the QProcess to finish. How do I force a flush of QProcess?
    do you use
    readyRead ,readyReadStandardError, readyReadStandardOutput signals ??
    this will be trigger every time the buffer is full or its flushed.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [SOLVED] Piping to QProcess very slow performance

    Quote Originally Posted by Phlucious View Post
    Second, when the actual data transfer between processes occurs, it is incredibly slow. The transfer rate appears to be around 400KB/s. When I compress a file in stand-alone mode, it takes approximately 1.369secs to run a 68MB file, so I know that the compression itself is relatively fast. The same file, when piped, takes approximately 170 seconds, and the CPU reports a 0% load on either process.

    I suspect that the slow performance has something to do with the fact that QProcess is optimized for basic text communication between processes (very small buffers), not for huge data transfers, but I see no way to change the buffer size for QProcess so that I can test this theory.
    I'd start by discarding QDataStream from the pipeline.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Multiple QGLWidgets slow performance
    By seesomi in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2013, 09:20
  2. Slow SQLite performance
    By themagician in forum Newbie
    Replies: 0
    Last Post: 26th April 2012, 14:23
  3. QT App performance is too slow on OSX
    By joshhhab in forum Newbie
    Replies: 1
    Last Post: 28th May 2011, 08:30
  4. Slow performance of QGraphicsView - why?
    By zeldaknight in forum Newbie
    Replies: 2
    Last Post: 25th August 2010, 03:34
  5. Replies: 1
    Last Post: 8th August 2010, 20:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.