xbmc/xbmc — pull request #3245 by bavison (2013-09-12 15:20:18+00:00)
Title: Faster sorting of CFileItemLists, step 1

CFileItemLists are sorted by first constructing a SortItems object that refers
back to each CFileItem by index, sorting the SortItems object, then rebuilding
CSortItemList::m_items (a vector of pointers to CFileItems) by examination of
the sorted version of the SortItems object.

It might be more sensible, long-term, to sort m_items directly, but in the
meantime, there are a couple of simple ways to make sorting with SortItems
sufficiently efficient that it's not a problem any more.

Previously, SortItems was a vector of SortItem objects, held by value; each
SortItem was a std::map (implemented as a red-black tree) which ended up
being constructed and destructed as each element of SortItems was moved.
This patch changes SortItems to be a vector of pointers to SortItems instead.

Benchmarks for CFileItemList::Sort() on a Raspberry Pi with a library of
600 movies:
Before patch: 4.6 seconds
After patch: 1.1 seconds