Important: Please read the Qt Code of Conduct -

Regarding the CPU Usage in arm board for an example of QTableView while scrolling

  • The link is here , here is the link for the specifications of the device

  • Lifetime Qt Champion

    Ok, so you have have a single core 1GHz processor with 512MB of RAM.

    What size is your model ?

  • @SGaist

    The size is 320 , 240.

  • Lifetime Qt Champion

    I meant the data model

  • @SGaist

    can u brief me up regarding the data model. what is it.?.

  • Lifetime Qt Champion

    @Pradeep-Kumar From your first post: "i have used QStandardItemModel as a model" - so I guess the question is how big is this model (how many elements does it contain)?

  • The standard item model data was having 3 columns and the rows values depends on DB values. it will increase as per the db values.

  • Lifetime Qt Champion

    Then what is the usual size of your database ?

  • Without Db also i tried the same, again i have observed the CPU % gradually increases to 100%. i didnt understand the behaviour. please guide me.

  • Lifetime Qt Champion

    Without any test case to run, it's pretty much impossible to help you get further. There's also no information about what else is running on your target or what your application does that might or might not be influenced by what happens in your GUI.

  • Their was some daemon process running, when i checked the application.

  • Lifetime Qt Champion

    Use top to see which is the processor hog: Likely your application but you have to verify to be sure.

    After that confirmation, it would also be useful if you could describe precisely how you trigger that CPU load.

    On a side note: which version of Qt are you using ? With which plugin ?

  • I will check the process bu using command top.
    I am using Qt version 5.7.

      <After that confirmation, it would also be useful if you could describe precisely how you trigger that CPU load.>

    I didnt get the above statement.

  • Lifetime Qt Champion

    After you confirmed that the CPU hog is indeed your application. It would be useful that you describe precisely what you do that makes the CPU go wild.

    You didn't wrote which plugin you were using for your application. xcb ? wayland ? eglfs ?

  • Sorry about that missed to inform the plugin, I am using .xcb plugin.

  • Here is link of the screenshot of the cpu usage of the application
    Application name is TableViewExample

  • Lifetime Qt Champion

    Which one of the QTableView example ? This one ?

  • Yes I have used QTableView , the example , and for the model i have used QStandardItemModel.
    I will post the code.

    m_pushButton = new QPushButton("Click To Get Data");
    m_standardModel = new QStandardItemModel;
    m_standardModel->setHorizontalHeaderItem(0,new QStandardItem("First Column"));
    m_standardModel->setHorizontalHeaderItem(1,new QStandardItem("Second Column"));
    m_tableview = new QTableView;


    I have created Object in constructor Above lines of code.
    And when i click the PushButton, i will be calling getData();

    void getData()
    int column_Count = 0;
    int row_Count = 0;

    QStandardItem *item,*item2;
        item = new QStandardItem("Qt");
        item2 = new QStandardItem("Company");


  • Lifetime Qt Champion

    Did you check at which number of rows the CPU starts to go under heavy load ?

  • It is hard to tell the bottleneck without test, but I would like to share some experiences of QStandardItemModel vs custom model.

    I have used QStandardItemModel and QTableView to create a rename tool before, the performance is quite horrible, even there are only several thousands of items(two column, original name vs name after changed), the speed could be very slow.

    To alleviate the problem, I use QAbstractTableModel to replace QStandardItemModel, after that, I can handle one million data without lag for most of the rename operations(most of them can show the results after rename on the second column instantly).

    In my custom model, I prefer QStringList(maybe std::vector<QString> would be faster) to store the data. I do not know the data structure underhood QStandardItemModel, but I guess it is some sort of tree like structure since QStandardItemModel need to be a universal model suit for every view, I suspect cache miss is the main reason why QStandardItemModel is so slow.

    Because of this experiences, I only prefer QStandardItemModel if

    1 : I know the size of the data are very small(less than two thousand rows)
    2 : Running out of development fee(Customer do not want to pay for performance)

Log in to reply