[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    KStringHandler: stateless/reentrant/thread-safe?
From:       Frank Reininghaus <frank78ac () googlemail ! com>
Date:       2012-10-26 18:15:46
Message-ID: CAFoZWWiQeBf+hmac7j03M_0_JewfHepCJrsJb8P-raA0akmUwg () mail ! gmail ! com
[Download RAW message or body]

Hi everyone,

Emmanuel is currently working on implementing a parallel sort
algorithm for Dolphin to speed up loading very large folders [1].
Sorting takes quite long due to the complexity of 'natural' sorting,
which uses the comparison function KStringHandler::naturalCompare().
There are ideas how to make the comparison faster (for some
discussion, see [2]), but thanks to the elegance of QtConcurrent, the
easiest way to get a short-term performance increase is using a
parallel sort algorithm.

Obviously, the parallel sort algorithm requires that all functions
involved in comparing items, in particular
KStringHandler::naturalCompare(), are reentrant. Now the API docs of
KStringHandler [3] say that "The methods here are completely
stateless", which sounds a bit vague. Does anyone mind if I add "This
function is reentrant" to the docs of
KStringHandler::naturalCompare(), just to be sure that no
modifications can be made that would break our sort algorithm? The
code looks like it really is reentrant, even thread-safe.

Best regards,
Frank

[1] https://git.reviewboard.kde.org/r/107025/
[2] http://lists.kde.org/?t=135099603800001&r=1&w=2
[3] http://api.kde.org/4.9-api/kdelibs-apidocs/kdecore/html/namespaceKStringHandler.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic