Review Request: Implemented multithreading in KFileItemModelSortAlgorithm

Frank Reininghaus frank78ac at googlemail.com
Fri Oct 26 19:26:20 BST 2012


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


Thanks! I see that we're getting there :-)

I'd like to wait a bit to see if anyone objects to declaring that KStringHandler::naturalCompare() is reentrant [1], but then this can be pushed to master (after taking into account at least my first comment below). Thanks for your work!

[1] http://lists.kde.org/?l=kde-core-devel&m=135127537418260&w=2


dolphin/src/kitemviews/private/kfileitemmodelsortalgorithm.cpp
<http://git.reviewboard.kde.org/r/107025/#comment16489>

    I still think that we should not have this check here.
    
    a) I think it's better if the hardcoded threshold (100) is in only one place. Imagine we want to change it at some later time - it's better if it only has to be changed in one place.
    
    b) The function gets much simpler without the check - just two lines.
    
    c) The only benefit of this check is that you save
    
    * a single call of QThread::idealThreadCount() the first time this function is executed
    * a call of parallelSort(), which redirects to seqentialSort() immediately, if the 'span' is small.
    
    In other words: the saving that this check, which makes the code harder to read IMHO, yields is really negligible.
    
    



dolphin/src/kitemviews/private/kfileitemmodelsortalgorithm.cpp
<http://git.reviewboard.kde.org/r/107025/#comment16490>

    The inner (...) are not needed here, but that's only a minor issue - doesn't matter much.


- Frank Reininghaus


On Oct. 26, 2012, 3:20 p.m., Emmanuel Pescosta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107025/
> -----------------------------------------------------------
> 
> (Updated Oct. 26, 2012, 3:20 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/f529b52a/attachment.htm>


More information about the kfm-devel mailing list