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

Tom Vercauteren tom.vercauteren at m4x.org
Mon Apr 7 08:14:53 EDT 2008


Hi Bill,

Thanks for your prompt feedback. I have posted a new patch on the bug tracker:
http://www.itk.org/Bug/view.php?id=6719

I have tested it on three different systems (one windows, one mac, one
linux). It hope it's OK now.

As a side note, I had troubles compiling ITK on mingw. If I set the
CMake option "BUILD_SHARED_LIBS" to "ON", I get link errors of the
type "multiple definition of [...] vnl_[...]". Setting
"BUILD_SHARED_LIBS" to "OFF" works fine though... Should I file this
on the bug tracker?

Best regards,
Tom

On Sat, Apr 5, 2008 at 6:26 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> 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