[vtk-developers] vtkViewPort->AddProp

Ken Martin ken.martin at kitware.com
Wed Feb 25 08:49:14 EST 2004


> While looking into performance issues we've noticed that it takes a
> long time to initially add a large number of actors to a renderer.  It
> seems that vtkViewPort's AddProp() function is checking to see if a
> vtkProp is already in its collection and the way its doing it is via an
> O(n) search.
> 
> This can be really painful if n is large.

We'll generally I'd say n shouldn't be large, but that isn't really correct.
The number of vtkOpenGLActors shouldn't be large, that is not its function.
But there is no reason a renderer shouldn't support having thousands of
vtkProps.

> Couple of questions:
> 
> 1. Why make vtkViewport responsible for the check instead of the
> consumer?  vtkViewport already provides a mechanism to getting the prop
> collection so if the application thinks its possible for something to
> be accidently added more than once it can test for it itself.

Just a convenience. But one that code now depends on.

> 2. If this is not desirable, then why not add an additional parameter
> to AddProp (and vtkRenderer's AddActor) to optionally prevent the
> check?  It could be defaulted to always do the check if necessary.

Seems like a good idea.

Thanks
Ken





More information about the vtk-developers mailing list