[Insight-users] Performance issues in itk::LightObject::Register and itk::LightObject::Unregister (patch included)

Bill Lorensen bill.lorensen at gmail.com
Sat Apr 5 00:26:41 EDT 2008


Tom,

I just tried your itkLightObject.cxx patch on MinGW and Borland. Both
generated compile errors for the type of arg to the
InterlockedIncrement function. On these machines It wants a pointer to
a long for these compilers. I changed m_ReferenceCount to from
"mutable volatile int" to "mutable long" and both compilers worked
fine. I suspect that these mods won't compile on Mac or GCC.

I think this patch needs some more portability work before we commit it.

Bill

On Fri, Apr 4, 2008 at 12:57 PM, Tom Vercauteren
<tom.vercauteren at m4x.org> wrote:
> Hi all,
>
> After some profiling on my application, I realized that ITK was
> spending some 15% of the time in the itk::LightObject::Register() and
> itk::LightObject::Unregister() functions. This was originating from
> the mutex lock used when incrementing and decrementing the reference
> counts.
>
> Similarly to other open-source libraries (Boost, QT, etc.) these locks
> can be avoided by using atomic operations.
>
> I have filed a bug on the bug tracker, it includes a patch that should
> work on windows, mac and any system using gcc (I only tested on
> linux):
> http://www.itk.org/Bug/view.php?id=6719
>
> It is related to a similar performance issue on time stamps:
> http://www.itk.org/Bug/view.php?id=6599
>
> It would be great if these patches could be integrated before the
> release of ITK 3.6.
>
> Best regards,
> Tom Vercauteren
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list