Fighting with new improved "resource system"

Another case:


– First select of one preset in listview: elapsed time: 1.99095s
– Next select of one preset in listview: elapsed time: 0.1s
– Select the 143 preset in listview: elapsed time: 7.28s

Seems to be the call to KisWdgTagSelectionControllerOneResource::setResourceIds() (from wdgtagselection.cpp)

And then seems to be the call to KisWdgTagSelectionControllerOneResource::updateView() (from wdgtagselection.cpp)

And then seems to be the following loop:

    Q_FOREACH(int resourceId, m_resourceIds) {
        m_tagResourceModel->setResourcesFilter(QVector<int>() << resourceId);
        for (int i = 0; i < m_tagResourceModel->rowCount(); i++) {
            QModelIndex idx = m_tagResourceModel->index(i, 0);
            KisTagSP tag = m_tagResourceModel->data(idx, Qt::UserRole + KisAllTagResourceModel::Tag).value<KisTagSP>();
            tagsCounts[tag->url()] += 1;
        }
    }

From here what I can see:
– The same Q_FOREACH(int resourceId, m_resourceIds) than previously seen, where there’s 15 iteration per brush
15 * 143 = 2145 !!
– In this loop there’s another loop which iterate on 16 - 17 items
2145 * 16 = 34320 total

– Didn’t check yet what we have behind:
m_tagResourceModel->setResourcesFilter()
m_tagResourceModel->rowCount()
m_tagResourceModel->data()

And I need to go to sleep :sweat_smile:
And I normally won’t be at home this week-end; so I’ll try to continue to analyze this part next week…

Grum999