From: Brad K. <bra...@ki...> - 2008-08-06 14:44:34
|
Tom Vercauteren wrote: > By the way, I realized that the current implementation of vnl_math_rnd > on my linux machine was slower than the straightforward non-optimized > code. It seems that the following change was made with no timing > tests: > http://vxl.cvs.sourceforge.net/vxl/vxl/core/vnl/vnl_math.h?r1=1.39&r2=1.40&sortby=date > On my machine, lrint is indeed (as mentionned in the comments) > approximatively 2.5 times faster than the straightforward code but > lround is approximatively 40% slower :( That change was made for purposes of correctness, not speed. Using lrint was actually producing wrong output if the FPU was configured to the wrong rounding mode. Whether lround is slower or faster than a hand-coded implementation depends on the compiler's implementation of it. -Brad |