[vtk-developers] vtkMath inline choices...

Moreland, Kenneth kmorel at sandia.gov
Wed Sep 15 11:24:14 EDT 2010


I can speak to why IsNan is not inlined.  The IsNan (and similar non-finite tests) rely on some non-portable functionality.  Depending on whether the isnan function is provided, IEEE-754 numbers are used, or if operations on NaNs are trapped, different implementations are provided.  Over time this can get even more complicated as we encounter computers and compilers that treat NaNs differently.  Quite simply, I did not want to expose all of this complexity in the header file.

If you plan to go through the trouble of moving that to the header file, you should do performance tests to make sure that there is a clear advantage to inlining the function.  I've been surprised in the past to find an inline function did not really perform any better than a function call.  The fact of the matter is that function calls are cheap operations nowadays.

-Ken


On 9/15/10 9:06 AM, "Sean McBride" <sean at rogue-research.com> wrote:

Hi again all,

I'm continuing my profiling, and now have a question about vtkMath.h...
How was it decided what to inline and what not to?

There are some 'big' methods like vtkMath::Cross() that are inline, and
yet there are some very short methods like vtkMath::IsNan() that are not
inlined.

I'm asking because I believe it could be beneficial for IsNan to be
inlined (though have not yet tested).

Cheers,

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


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtk-developers





   ****      Kenneth Moreland
    ***      Sandia National Laboratories
***********
*** *** ***  email: kmorel at sandia.gov
**  ***  **  phone: (505) 844-8919
    ***      web:   http://www.cs.unm.edu/~kmorel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100915/8c2a0caa/attachment.html>


More information about the vtk-developers mailing list