IRC - and spinlocks

Kevin Funk kfunk at kde.org
Thu Nov 20 14:21:08 GMT 2014


On Wednesday 19 November 2014 20:04:41 René J.V. Bertin wrote:
> 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?

Nope, the whole interaction with the itemrepository. The 
'bench_itemrepository' test does that.

> > 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?

Right, it's in KF5.

> 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).

No objections.

> 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?

Feel free to investigate and file a patch. I don't really have the time to go 
through it atm. There's lots of legacy code that could/should be improved!

> Cheers,
> René

Greets

-- 
Kevin Funk | kfunk at kde.org | http://kfunk.org



More information about the KDevelop mailing list