[vtkusers] floating-point vs. integer performance
David Gobbi
dgobbi at irus.rri.ca
Thu Jun 14 14:22:07 EDT 2001
Some of you might find this interesting:
I added some templates to vtkImageReslice so that it can do all
transformation & interpolation operations with either fixed-point
or floating-point arithmetic, with a method to switch between
them at run-time.
At first I was overjoyed, because on my PIII machine the fixed-point
code ran twice as fast (in some special cases as much as four times
as fast) as the original floating-point version.
But then I compiled it on an R10000 IRIX computer, and the fixed-point
math was 20% slower than the floating-point math. On an R12000 IRIX,
the fixed-point math was 50% slower.
In any case, though, the 2X933MHz PIII beat the 2X400MHz R12000 at
both fixed-point and floating-point (not by much) and was a lot cheaper.
I probably won't be committing the new version of vtkImageReslice,
because the extra templates complicate the code a bit.
There is one small benefit to using fixed-point math over floating-point
for image filters (apart from speed on Intel platforms):
you will always get exactly the same result image (bit-for-bit)
regardless of what platform you run on. With floating-point,
different CPU/compiler combinations give slightly different results.
- David
--
David Gobbi, MSc dgobbi at irus.rri.ca
Advanced Imaging Research Group
Robarts Research Institute, University of Western Ontario
More information about the vtkusers
mailing list