Deformable registration in D

Robert Jacques sandford at jhu.edu
Thu Aug 2 17:25:59 PDT 2007


On Wed, 01 Aug 2007 07:40:05 -0400, Don Clugston <dac at nospam.com.au> wrote:

> Awesome!
> A few comments:
> (1) D's exp() shouldn't be too much slower than C's. Certainly not a  
> factor of four. (Unless you were creating a lot of denormalised  
> numbers). So your result is interesting. Perhaps there is a performance  
> bug in exp().
> (2) DMD does essentially no floating-point optimisation. The fact that  
> it can compete directly with Visual C++ is impressive, since there is  
> enormous potential for improvement (a factor of 2 at the very least).

This actually this isn’t too unexpected. MSVC7 uses the SSE2 optimized exp  
function, which performed similarly to simple addition as other  
bottlenecks, like memory bandwidth, seemed to come into play. And both D  
and C should read and write arrays at about the same speed.

> (3) The increased stability could also be due to the use of 80-bit reals  
> instead of 64 bits. You could easily test this by putting
>  import std.c.fenv;
>  fesetprec(FE_DBLPREC);
>  into main(), and seeing if the stability disappears.

Actually, while I did some tests using reals, I ended up using floats in  
the end to cut down on memory traffic, which was the main bottle neck at  
the time, and improved the algorithm's fundamental stability.

>  (4) My experience has been that D is a superb language for developing  
> floating-point algorithms. It's great to see further confirmation of  
> this.

I agree.

>  I presume that you were using DMD, not GDC. If not, it would explain  
> (1) and (2).

And, yes, I was using DMD.

Thanks for the suggestions.
I'm going to look into the exp function directly.




More information about the Digitalmars-d-announce mailing list