[vtk-developers] vtkMath inline choices...

David Gobbi david.gobbi at gmail.com
Sun Jan 30 13:24:13 EST 2011


Hi Ken,

The main issue with performance and IsNan() is more about how it is used
than about whether it is inlined.  My guess is that Sean saw a performance
hit because IsNan() was used inside vtkLookupTable, which has some of the
hottest loops in all of VTK.  The IsNan() check was applied to all
datatypes, even though it is not relevant for integer data.

I've patched vtkLookupTable so that it overloads vtkLinearLookup() and the
IsNan check is only done on float and double.  The new code gives me a 40%
speedup in color mapping a 16-bit image to RGBA.  The patch can be seen
here: http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=1c348fcb.  I merged it
directly into master.

There is also a function in vtkScalarsToColorsPainter that applies IsNan()
regardless of scalar type.  It could benefit from a similar patch.

 - David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110130/680f4530/attachment.html>


More information about the vtk-developers mailing list