IRC - and spinlocks
René J.V. Bertin
rjvbertin at gmail.com
Wed Nov 19 19:04:41 GMT 2014
On Wednesday November 19 2014 01:02:28 Kevin Funk wrote:
Hi,
> Good point, feel free to benchmark that. We already have benchmarks covering
> the repositories ('bench_itemrepository').
Benchmark how, a raw comparison of gettimeofday against a more lowlevel function?
> Well, yes, I'd rather benchmark the itemrepository code first and check if
> just using a mutex would suffice. (We have quite a bit of legacy code which is
> overly complex and serves no good, just as the "SpinLock" class.)
I don't find anything called bench_itemrepository, neither among the filenames nor in the code. That wouldn't happen to be in the KF5 branch, perchance?
It's true that you're not likely to require realtime performance (whatever that means :)) but I'm a firm believer in doing things as economically as possible. If it doesn't pay today, it might do so later - and doubly so (because you don't have to figure out the reason of a performance bottleneck and how to remedy it).
The code that uses the spinlocks isn't the easiest to assess in a glance (esp, which operations are on basic types and which involve OO objects, overloaded operators etc). But I see part of the code concerns reference counting, and there it might be possible to protect the more frequently called operations with something like QAtomicInt (i.e. only when exclusive access is really required), and a standard mutex in other places?
The other part of the code actually seems to use a spinlock PLUS a QMutex (e.g. DuChain::addDocumentToChain), is that necessary?
Cheers,
René
More information about the KDevelop
mailing list