[vtk-developers] vtkGarbageCollector performance

Sean McBride sean at rogue-research.com
Thu Feb 3 14:41:34 EST 2011


Ken,

Thanks for this suggestion.

I'd still like to know if anyone knows what the deal with
VTK_LEAN_AND_MEAN is.

In any case, attached is a patch that improves the gc performance a
little bit. There are basically two changes:
 1- wrap some code in VTK_LEAN_AND_MEAN
 2- don't evaluate end() every time through loops

No tests started failing, but I'm not sure #2 is correct everywhere
since it does change semantics a bit.

Anyone familiar with vtkGarbageCollector???

Cheers,

Sean


On Wed, 2 Feb 2011 10:42:33 -0700, Moreland, Kenneth said:

>If you have a section of code that destroys several objects that invoke
>the garbage collector, then you can temporarily suspend garbage
>collection until you are finished with the bulk of deletions.  Thus, you
>can replace the many passes of the garbage collector with one single
>pass.  To do that, use the static methods
>vtkGarbageCollector::DeferredCollectionPush() and
>vtkGarbageCollector::DeferredCollectionPop().
>
>-Ken
>
>
>On 2/1/11 5:14 PM, "Sean McBride" <sean at rogue-research.com> wrote:
>
>Hi all,
>
>We've been profiling our app and finding that lots of time is spent in
>VTK's garbage collector.
>
>Part of the problem is that we are creating too many temporary objects,
>but I still wanted to investigate a little to see if there are any
>obvious improvements to be had in vtkGarbageCollector itself.
>
>One thing I noticed is that some code is conditionalised with #ifdef
>VTK_LEAN_AND_MEAN.  Yet I can't seem to find where VTK_LEAN_AND_MEAN is
>set on or off (except in vtkWinCE.h, which shouldn't apply to me).
>What's it for?  Where should I be turning it on?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PERF-minor-improvements-to-vtkGarbageCollector-perfo.patch
Type: application/octet-stream
Size: 6362 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110203/481ae089/attachment-0001.obj>


More information about the vtk-developers mailing list