]> cloud.milkyroute.net Git - dolphin.git/commit
KFileItemModel::insertItems(): guarantee O(N) run time complexity
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 22 May 2013 16:27:05 +0000 (18:27 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 22 May 2013 16:27:44 +0000 (18:27 +0200)
commitbf85483c99b549334cff3e83e861121748d5d5c1
tree4845bfcdb304635b2b410ca2440829f1ff6007e4
parent01761798a93bc93f3e16f8fb68fe5739ab66d98b
KFileItemModel::insertItems(): guarantee O(N) run time complexity

This commit prevents repeated insertions of single items into the list
m_itemData, which shift all following items by one position and result
in O(N^2) worst case complexity for the entire function.

Moreover, the hash m_items is updated only for the items starting from
the first inserted/removed item to save some superfluous calculations
of hash values.

REVIEW: 110355
src/kitemviews/kfileitemmodel.cpp