diff options
| author | Frank Reininghaus <[email protected]> | 2013-10-02 19:08:39 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-10-02 19:08:39 +0200 |
| commit | ae587d2682992644217c58968c6c771a1f2571f7 (patch) | |
| tree | 93bfd610a983db9a8bc32bf6e93e2c1dbe0534a8 /src/kitemviews/kfileitemmodel.h | |
| parent | 926782d3be2502c6d3e87ef992aa371c081d72b4 (diff) | |
Save memory and time in KFileItemModel by lazy-loading the "ItemData"
To reduce unnecessary memory comsumption and CPU usage, we only fill the
QHash<QByteArray, QVariant> if the methods data(int) or setData(int) are
called for the corresponding index, or the data is necessary for sorting
the model.
According to my tests, this patch reduces the memory usage when loading
a folder with 100,000 items by 17% in Icons View, and by 26% in Details
View.
REVIEW: 112725
Diffstat (limited to 'src/kitemviews/kfileitemmodel.h')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 841016138..50e3e326b 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -492,7 +492,11 @@ private: inline bool KFileItemModel::isChildItem(int index) const { - return m_requestRole[ExpandedParentsCountRole] && m_itemData.at(index)->values.value("expandedParentsCount").toInt() > 0; + if (m_itemData.at(index)->parent) { + return true; + } else { + return false; + } } #endif |
