On Thursday, January 17, 2008, at 02:06PM, "Christiaan Hofman" <[EMAIL 
PROTECTED]> wrote:
>You know if there is a difference in efficiency between @synchronized  
>and a lock? I wondered if it would make sense to replace the lock in  
>BDSKThreadSafeMutableArray by @synchronized(self).

I generally avoid @synchronized in loops because it's convenient, but 
performance sucks (it really was bad for the type manager's shared instance).  
This is mainly due to ObjC exception handler overhead and id2data, I think, so 
it could be cheaper with ObjC 2.0's 64-bit zero-cost exceptions.  It's also a 
recursive mutex, which introduces additional weirdness.  The mutable dictionary 
subclass just wraps things up nicely with a readwrite lock; I doubt there's a 
measurable performance gain in this case.

http://macbook.pro/2007/04/24/synchronized-swimming/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-develop mailing list
Bibdesk-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to