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

QIODevice->QBuffer->QByteArray Deserialization Slow

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 5.4.0
    • Core: I/O

    Description

      When compared to Qt 4.8.0 on the same environment, byte array deserialization through the QIODevice read method is 6 (static 64 bit build) to 8 (qt provided 32 bit dll) times slower on a Windows 7 environment.

      I used this code to reproduce the slowdown:
      Note: Code ran on it's own processing thread aside from the main thread
      Note: AT5_ASSERT is an assert control to the main thread
      Note: AT5_STATUS is a status message control to the main thread
      Note: m_Settings.m_StrBlk.x is a integer containing 100 million for my test runs

          AT5_ASSERT(m_Settings.m_StrBlk.x > 0, "Block Size Must be Greater Than 0.");
          AT5_STATUS(QString("Attempting Byte Array Deserialization(%1 bytes)").arg(m_Settings.m_StrBlk.x));
          QByteArray data(m_Settings.m_StrBlk.x, Qt::Uninitialized);
          QIODevice* pIODevice = new QBuffer(&data);
          if(pIODevice == NULL) { AT5_STATUS("Failed to Initialize IO Device"); }
          else
          {
              if(!pIODevice->open(QIODevice::ReadOnly)) { AT5_STATUS("Failed to Open IO Device"); }
              else
              {
                  //Parse Data
                  QTime stopWatch;
                  tUChar byte;
                  stopWatch.start();
                  for(int x = 0; x < m_Settings.m_StrBlk.x; ++x)
                  {
                      pIODevice->read(reinterpret_cast<char*>(&byte), 1);
                  }
                  AT5_STATUS(QString("Run Time: %1 ms").arg(stopWatch.elapsed()));
                  pIODevice->close();
              }
              delete pIODevice;
          }
      

      Timings on test runs showed 550 ms->3225 ms time increases on my static build and 825 ms->6400 ms time increases on qt provided dlls.

      Slowdowns on my actual applications were in the 25%-30% range with some people reporting 10000% (4 hours to 45 hours) increases but not personally verified.

      Issue appears partially related to QTBUG-28968.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            gregory.iverson greg iverson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes