Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

What should I do if my code get bad performance in newer Qt5 version?



  • Hi,
    I am developing a program recently. At the beginning, I choose Qt5.9.3 and the performance is satisfactory. But after upgrading Qt to newer version(had tried 5.9.4 5.9.5 5.9.7 5.10.0 5.11.0 5.12.0), the performance is more and more worse. I use perf to check out what happened, the result shows that below function is my bottleneckļ¼š

    void MainWindow::updateModel(int row, Session *s, bool append)
    {
        int i=0;   
        if(append){
            ue_list_model->setItem(row, i++, new QStandardItem(stat[s->getStat()]));
            ue_list_model->setItem(row, i++, new QStandardItem(s->getImsi().getImsiString()));
            ue_list_model->setItem(row, i++, new QStandardItem(s->getApn().getApn()));
            ue_list_model->setItem(row, i++, new QStandardItem(s->getRFTeidC().getFTeid()));
            QStandardItem *item = new QStandardItem(s->getDefaultBearer()->getRFTeidU().getFTeid());
            item->setToolTip(s->getRTeidUList());
            ue_list_model->setItem(row, i++, item);
            ue_list_model->setItem(row, i++, new QStandardItem(s->getLFTeidC().getFTeid()));
            item = new QStandardItem(s->getDefaultBearer()->getLFTeidU().getFTeid());
            item->setToolTip(s->getLTeidUList());
            ue_list_model->setItem(row, i++, item);
            ue_list_model->setItem(row, i++, new QStandardItem(s->getPaa().getPaa()));
            ue_list_model->setItem(row, i++, new QStandardItem(s->getRatType().getRatType()));
            ue_list_model->setItem(row, i++, new QStandardItem(s->getBearersEbi()));
            model_map[s] = ue_list_model->item(row);
            ue_list_model->item(row)->setData(QVariant::fromValue(s));
            for(int j=0;j<i;j++){
                ue_list_model->item(row, j)->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemNeverHasChildren);
            }
        }else{
            ue_list_model->item(row, i++)->setText(stat[s->getStat()]);
            ue_list_model->item(row, i++)->setText(s->getImsi().getImsiString());
            ue_list_model->item(row, i++)->setText(s->getApn().getApn());
            ue_list_model->item(row, i++)->setText(s->getRFTeidC().getFTeid());
            ue_list_model->item(row, i)->setText(s->getDefaultBearer()->getRFTeidU().getFTeid());
            ue_list_model->item(row, i++)->setToolTip(s->getRTeidUList());
            ue_list_model->item(row, i++)->setText(s->getLFTeidC().getFTeid());
            ue_list_model->item(row, i)->setText(s->getDefaultBearer()->getLFTeidU().getFTeid());
            ue_list_model->item(row, i++)->setToolTip(s->getLTeidUList());
            ue_list_model->item(row, i++)->setText(s->getPaa().getPaa());
            ue_list_model->item(row, i++)->setText(s->getRatType().getRatType());
            ue_list_model->item(row, i++)->setText(s->getBearersEbi());
        }
    }
    

    This function behaves good with Qt5.9.3 since I can not feel any delay. But with new version and same code, I can feel the delay of UI updating obviously. Should I treat this as a bug?


  • Lifetime Qt Champion

    Hi,

    Performance regression are usually treated as bugs.

    One thing you can to is check the release logs to see if anything related to that has changed between 5.9.3 and 5.9.4.


Log in to reply