[vtk-developers] vtkMath inline choices...
Sean McBride
sean at rogue-research.com
Mon Jan 31 11:04:22 EST 2011
On Sun, 30 Jan 2011 11:24:13 -0700, David Gobbi said:
>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.
David,
Yes, exactly. Thanks for improving it. In fact I have a local branch
with changes similar to what you just did, but I wanted to go slowly,
and thought the leaf of the problem (isnan) was a good place to start.
This part:
+ // calling isnan() instead of vtkMath::IsNan() improves performance
+#ifdef VTK_HAS_ISNAN
+ if (isnan(v))
+#else
+ if (vtkMath::IsNan(v))
+#endif
I'm sure you agree is silly, and can be done away with once we fix
vtkMath::IsNan().
Try as I may, I can't figure out how to add a comment in Gerrit. My
patch did not include the installation of vtkMathConfigure.h because I
don't know how to do that. Marcus' suggestion of using vtkConfigure.h
is maybe a better idea anyway? What do we prefer? I can update my patch.
Cheers,
--
____________________________________________________________
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