[vtk-developers] vtkImageReslice performance questions/improvemnts
Sean McBride
sean at rogue-research.com
Tue Sep 14 10:43:57 EDT 2010
Hi all,
We've been profiling our app lately, and I've found some of our
bottlenecks are in vtkImageReslice.
One is vtkResliceRound() here:
<http://vtk.org/gitweb?p=VTK.git;a=blob;f=Imaging/
vtkImageReslice.cxx;h=2c65fbd922fd6b9daeae39110232d19ef21e6b93;hb=HEAD>
It has a bunch of incomprehensible (but clever!) CPU-specific
implementations, but the general implementation is:
inline int vtkResliceRound(double x)
{
return static_cast<int>(floor(x+0.5));
}
The comments indicate that the slow floor() is the reason for the CPU-
specific implementations. But I don't see the need for the floor() at
all. floor() returns double, but then we cast to int anyway. So why
not skip the floor and cast straight to int?
In my usage, that change works and is much faster. Is there some edge-
case that I'm not seeing?
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