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

[REG] Add and remove rows much slower in 5.12.x versus 5.11.x

    XMLWordPrintable

Details

    • All

    Description

      Hi,

      I'm not an expert in Qt but I have been working with it for about a year.  I'm designing a system for the DoD which requires fast reaction time.  Essentially I'm reading from a database, populating the data using QStandardItem(s) into a QStandardItemModel.  Nothing fancy. 

      In 5.11 when I insert into the model, it runs extremely fast.  Delete is equally as fast.  However the same code running on 5.12 is much slower.  Also in 5.11 I'm able to sort using by simply 

      using treeView->sortByColumn(columnNumber, Qt::AscendingOrder); without the need for QSortFilterProxyModel.  In addition, in 5.11 when I remove hundreds of rows at a time the memory seems to be stable (not going up), however in 5.12 the memory continues to grow.

      The way I add rows is as follows:

      QList<QList<QStandardItem *>> QStandardItemList
      QStandardItemModel *metaDataModel = new QStandardItemModel;
      
      //remove Rows (could be hundreds or even thousands - the more rows the longer it takes)
      >if(rowNumber > NUMBER_ROWS_TO_DISPLAY)
       {
          int  numberOfRowsToRemove = rowNumber - NUMBER_ROWS_TO_DISPLAY;
           //this next command is very slow on 5.12 but very fast in 5.11
           rowNumber -=    numberOfRowsToRemove;
          metaDataModel->removeRows(0,   numberOfRowsToRemove, QModelIndex());
      }
      //Add a row  (could be hundreds or thousands of rows)
      for(rowIterator = 0; rowIterator < QStandardItemList.size(); rowIterator++)
      { 
           //Insert Rows
           //This is also slower in 5.12 but very fast in 5.11
           metaDataModel->setItem(rowNumber, 0, QStandardItemList[rowIterator][colNum]);
           for (columnIterator = 1; columnIterator < QStandardItemList[rowIterator].size(); columnIterator++)
          {
              metaDataModel->setItem(rowNumber, columnIterator, QStandardItemList[rowIterator]   [columnIterator]);
          }
          metaDataModel->setItem(rowNumber, 0, QStandardItemList[rowIterator][colNum]);
          rowNumber++
      }
      

       
      If you could let me know when you plan on investigating this issue, I would appreciate it since I need to  report to my managers.  The organization doesn't like going back releases only forward.  So for now I'm stuck with 5.12.x.  I also tried with 5.13 with the same results, very slow inserts and deletes.

       

      Attachments

        1. main.cpp
          2 kB
        2. main.cpp
          0.2 kB
        3. mainwindow.cpp
          4 kB
        4. mainwindow.h
          0.5 kB
        5. mainwindow.ui
          0.9 kB
        6. QtRowsTest.pro
          1.0 kB
        7. QtRowsTest.pro.user
          45 kB

        Issue Links

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

          Activity

            People

              vhilshei Volker Hilsheimer
              dantheman Dan Jersky
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes