Patch: wake up duchainlock writers

David Nolden zwabel at googlemail.com
Mon Dec 14 19:31:55 UTC 2009


Am Montag 14 Dezember 2009 17:58:17 schrieb Hamish Rodda:
> Hi,
> 
> I've made a patch to DUChainLock to enable it to wake up writers which have
> had to contend for a lock, rather than waiting for their usleep(10000) to
>  end. This has the effect of making multiple parser threads more efficient
>  than just one thread for the duchainify tool. (4 threads - 34.3s, 1 thread
>  - 38.0s) This is pretty cool, because before, I found that using 4 threads
>  actually added 10s.  mutrace shows that with this patch, lock contention
>  becomes a much bigger issue, which is to be expected.
I guess the problem is pretty much the same, expect that the tracing problem 
didn't 'detect' the lock contention before.

> I'm posting here as I have not had sufficient time to test it with
>  kdevelop, and also it seems slower (although not measured)... which is
>  pretty weird. Any ideas? Post your experience with it...

Hmm, that usleep(10000) penalized writers a lot, and since the writers are 
always background threads, that penalization might make the UI feel faster.

Otherwise the patch looks OK, but it might make more sense to choose the 
mechanism that makes the UI feel faster, rather than the one that makes the 
background parsing faster. I'm not sure about this one.

Greetings, David




More information about the KDevelop-devel mailing list