Thiago Bastos wrote: > Hi Gerrit, > > I'm looking at it and are about to change the refcounting to atomic > operations. It's just compiling right now so I will know more > soon ;) Hopefully you'll have a stable ref counter as you hit office > tomorrow morning ;) > > > Hmmm, and what are the impacts of that change? > > Clearly, atomic ref-counting is needed if you're running more than one > thread in the same aspect. But if it's going to make things slower for > programs that do not have multi-threaded aspects, I'd advocate for it > not making into the trunk (or at least not as a default option).
I don't think we need to worry, as there are fast cpu-specific instructions for this that most compilers support. They differ a bit, so one needs to code for different platforms/compilers etc. On MSVC there is an (IIRC) InterlockedIncrement() intrinsic function (i.e. one that compiles down to a single instruction) that handles this. No mutexes needed, which is nice. Some extra memory barriers may be needed, but I think that's pretty negligble (it's never been a problem for me in previous apps). If it's a problem, then you need to look at your reftptr usage pattern. :) I don't know what Gerrit went with in his first implementation, but it's easy to optimize. Cheers /Marcus ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
