Implemented multithreading in KFileItemModelSortAlgorithm

Review Request #107025 - Created Oct. 24, 2012 and submitted

Emmanuel Pescosta
Implemented multithreading in KFileItemModelSortAlgorithm.

If more than 100 items to sort and ideal thread count is greater than 1 -> sort them with parallelSort (2 Threads)

Use maximal 2 Threads, because more than 2 Threads are "slower" (more overhead than speed up). (I also have a patch which uses n Threads for sorting, if you want test it ;)
About 2 seconds faster with sorting 500.000 files.
About 5 seconds faster with sorting 1.000.000 files.


  • 0
  • 8
  • 2
  • 10
Description From Last Updated
Frank Reininghaus
Mark Gaiser
Emmanuel Pescosta
Frank Reininghaus
Emmanuel Pescosta
Frank Reininghaus
Mark Gaiser
Mark Gaiser
Frank Reininghaus
Frank Reininghaus
Frank Reininghaus
Commit Hook
Emmanuel Pescosta
Review request changed

Status: Closed (submitted)

Mark Gaiser
I just saw one issue in the code that you probably forget to update.
The KFileItemModelSortAlgorithm::sequentialSort function has calls to "sort". That used to be fine, but the sort function is now following the parallelSort path. I think you have to change the two "sort" calls in KFileItemModelSortAlgorithm::sequentialSort to "sequentialSort". Right now everything ends up using parallelSort unless i'm reading it wrong..
  1. Oh ... Yes you are right ... I will fix it ;)
  2. Am I allowed to push the small change without review request?
    sort(model, begin, middle);
    sort(model, middle, end);
    sequentialSort(model, begin, middle);
    sequentialSort(model, middle, end);
  3. I would say yes, but i'm not the dolphin maintainer. Wait till Frank comes by again and gives you another ship it.
  4. Good catch! It is so obvious that this makes sense (even though we've all missed it, hehe) that I'd say that you could have even pushed it without asking. Thanks!