[vtk-developers] vtkViewPort->AddProp
Sebastien BARRE
sebastien.barre at kitware.com
Wed Feb 25 15:41:43 EST 2004
Hi
At 2/24/2004 04:57 PM, Robert M.O'Bara wrote:
>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.
Well I think I added that check some time ago (Apr 2003), as well as the
HasProp() method. I'm pretty sure I added this code because we found out
some problems with actors being added twice or more in ParaView or VolView
for example, and it ended up difficult to track down actually.
>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.
I'd rather favor this solution, this would prevent old code from breaking.
Ideally I'd favor a call to HasProp() followed by AddProp() / RemoveProp(),
that's why I added HasProp() in the first place, but there is no way to
really enforce that, that's why the HasProp() is done for you, for the
"benefit" of the average user. I know it's O(n), but I'm surprised it takes
that much time, sorry about that, how many actors do you have ?
Anyway, you will probably have to add another signature/method, because I
don't think we really support parameters with default values, it's a bit
unusual in VTK's signatures. Maybe something like AddPropNoCheck(), I don't
know. I should update the documentation of AddProp()/RemoveProp() though,
to explain that a HasProp() is performed.
Comments ?
--
Sebastien Barre
More information about the vtk-developers
mailing list