Review Request: Implemented multithreading in KFileItemModelSortAlgorithm

Emmanuel Pescosta emmanuelpescosta099 at gmail.com
Fri Oct 26 10:16:39 BST 2012



> On Oct. 25, 2012, 5:53 p.m., Mark Gaiser wrote:
> > dolphin/src/kitemviews/private/kfileitemmodelsortalgorithm.cpp, line 75
> > <http://git.reviewboard.kde.org/r/107025/diff/3/?file=92347#file92347line75>
> >
> >     Ehh for a 2 core system this would result in 0.. 
> >     
> >     And with the numberIfThreads / 2 you apparently want to prevent a situation where one sorts a massive folder and all cpu threads get used to do the sorting..
> >     
> >     Then why don't you just do this:
> >     if (numberOfThreads > 2) {
> >       const int newNumberOfThreads = numberOfThreads - 1;
> >       ...
> >     }
> >     
> >     That would allow you to always have one thread free for the other stuff. Thus this implementation will never get executed on dual core systems, only on 2+ core systems. And with that it takes as much threads as it can (again, leaving 1 thread free for other apps).

> Ehh for a 2 core system this would result in 0.. 
Nope ... 2 / 2 = 1 ;)

> Thus this implementation will never get executed on dual core systems, only on 2+ core systems.
Dual core systems bring a lot of speed up (see my small benchmark) -> Sorting 500.000 files without threading 6492 ms but with 2 threads only 4318 ms

> again, leaving 1 thread free for other apps
Why? We have a process scheduler for that? See CFS or BFS ...


- Emmanuel


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107025/#review20897
-----------------------------------------------------------


On Oct. 25, 2012, 7:42 p.m., Emmanuel Pescosta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107025/
> -----------------------------------------------------------
> 
> (Updated Oct. 25, 2012, 7:42 p.m.)
> 
> 
> Review request for Dolphin and Frank Reininghaus.
> 
> 
> Description
> -------
> 
> 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 ;)
> 
> 
> Diffs
> -----
> 
>   dolphin/src/kitemviews/private/kfileitemmodelsortalgorithm.h 3a596df 
>   dolphin/src/kitemviews/private/kfileitemmodelsortalgorithm.cpp e0aac13 
> 
> Diff: http://git.reviewboard.kde.org/r/107025/diff/
> 
> 
> Testing
> -------
> 
> About 2 seconds faster with sorting 500.000 files.
> About 5 seconds faster with sorting 1.000.000 files.
> 
> 
> Thanks,
> 
> Emmanuel Pescosta
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20121026/d01741cc/attachment.htm>


More information about the kfm-devel mailing list