[vtk-developers] vtkDataArray performance; vtkErrorMacro semantics

Sean McBride sean at rogue-research.com
Tue Apr 26 14:58:09 EDT 2016


Hi all,

So we're continuing to profile our app to improve the performance of something, and I have another vtkDataArray question.  This method:

void vtkDataArray::SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx,
                            vtkAbstractArray *source)

starts with 3 checks.  If they fail, it uses vtkErrorMacro and bails.

First, what are the semantics of hitting vtkErrorMacro?  Is it meant to be like an assertion, ie something that should be impossible, and therefore useful in debug but discardable in release?

We've added assert(0) in the three branches, and our code never hits them and no VTK unit test does either.

The 3 checks are individually fast, but the method is called so very very often that removing the 3 checks entirely gives us a full 20% runtime speedup of Render(), so I'm hoping it would be acceptable to wrap them in #ifndef NDEBUG, or otherwise remove them from release builds.

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtk-developers mailing list