]> cloud.milkyroute.net Git - dolphin.git/commit
Fix KFileItemModel performance regression
authorFrank Reininghaus <frank78ac@googlemail.com>
Thu, 7 May 2015 20:09:01 +0000 (21:09 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 7 May 2015 20:14:00 +0000 (22:14 +0200)
commite69d3489751ea15c0477fe1d41fcc252c775d377
treec8082bdf7dc464cd5b6c84ddc26f6cfad16682f4
parent5bde333ca7e9c285f1101bac0434fb4e60b6d4d5
Fix KFileItemModel performance regression

Commit 119f7a3f fixed a crash that was caused by the porting of the
natural sorting code to QCollator. QCollator is not thread-safe, so
every thread needs its own instance. However, that commit made every
recursive call in the sorting code create a new deep-copied QCollator
instance, which is quite expensive and thus made inserting any items
into the model very slow (this could also be seen in the KFileItemModel
benchmark).

This commit avoids unnecessary QCollator copying by forcing all sorting
functions which are called in the same thread to pass the 'lessThan'
object by const reference, such that no unnecessary copying of that
object, including a deep copy of the QCollator, takes place.

REVIEW: 123620
src/kitemviews/private/kfileitemmodelsortalgorithm.h