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

Bottleneck for QVector::clear in QThreadPool

    XMLWordPrintable

Details

    • Windows

    Description

      I am using QThreadPool to run a worker that has a function to create and then clear a huge QVector and write a huge file. However, every time one worker reaches that line (QVector::clear/QFile::close), all the threads freeze and will continue when it is finished.

      Do you think it is a bug, or is that a natural way of clearing the vector in QThread?

      It would be good if other threads could still run normally when one of the workers runs those two functions (QVector::clear/QFile::close). For QFile::close, I tried using QFile::flush in my iteration instead of close() at the end of iterations, but it's not helping the performance.

      I attached codes when the thread gets slower when clearing the vector.

      Attachments

        1. TestQVector.zip
          9 kB
          Zufry Malik Ibrahim
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            zufryy Zufry Malik Ibrahim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes