January 19, 2007
Paulo Herrera wrote:
> Hi,
> I've be investigating about performance of different programming
> languages/compiler using some micro-benchmarks like the one posted in this
> thread. I observed that in many of them library implementations are much
> more important than the language itself. Some of my results are posted here
> http://pauloherrera.blogspot.com/ .
> 
> In the case of random number generators the performance difference among
> different implementations/algorithms in the same language can be orders of
> magnitude.
> I don't know why all libraries do not implement the Mersenne-Twister
> algorithm that is considered as the fastest and highest quality (most
> random).
> 
> Paulo
> 

Nice blog. Hopefully in the near future or so DMD will get improved floating point code generation. If so, that should put it at/near the top for each test you sited.

D itself has an advantage that may turn out to be very important for numerical codes; the real data type supports the hardware maximum, so for example D supports 80 bit precision on x86 where other languages/compilers don't. Plus there isn't a limit in the D spec. on maximum precision so D compilers can optimize more aggressively.

Performance aside, what was your impression on writing the code for each language?

Thanks,

- Dave
January 19, 2007
Dave wrote:

> Paulo Herrera wrote:
>> Hi,
>> I've be investigating about performance of different programming
>> languages/compiler using some micro-benchmarks like the one posted in
>> this thread. I observed that in many of them library implementations are
>> much more important than the language itself. Some of my results are
>> posted here http://pauloherrera.blogspot.com/ .
>> 
>> In the case of random number generators the performance difference among
>> different implementations/algorithms in the same language can be orders
>> of magnitude.
>> I don't know why all libraries do not implement the Mersenne-Twister
>> algorithm that is considered as the fastest and highest quality (most
>> random).
>> 
>> Paulo
>> 
> 
> Nice blog. Hopefully in the near future or so DMD will get improved floating point code generation. If so, that should put it at/near the top for each test you sited.
> 
> D itself has an advantage that may turn out to be very important for numerical codes; the real data type supports the hardware maximum, so for example D supports 80 bit precision on x86 where other languages/compilers don't. Plus there isn't a limit in the D spec. on maximum precision so D compilers can optimize more aggressively.
> 
> Performance aside, what was your impression on writing the code for each language?
> 
> Thanks,
> 
> - Dave

Hi Dave,
I didn't write the tests, I only downloaded them from
http://shootout.alioth.debian.org/.
I really wanted to see if I could observe some difference among compilers,
and if I could reproduce the results posted on that site.

I've been frustrated about the fact so many people discuss languages performance without facts. I do really have to run lots of simulations that can take several hours. Therefore, performance is really important to me, and 20% or 30% difference can help me to graduate some months earlier, ;D.

I have some experience with other languages such as: Python, Java, C++, Fortran95. Comparing to them, I think D has a lot of advantages and I'd really like to use it instead of any of the other ones. It's cleaner, more concise, templates are great, relatively fast, etc. However, I see two problems to use D for number crunching:

1) lack of multidimensional arrays. I know that has been mentioned several times in this forum. My first idea was to write my own class. So, I did it, but it performed much worse than some Fortran compilers.... How bad? Well, nested loops were 8-9 times slower. I couldn't believe that difference. I tried/checked many things to fix that: inlining, memory order, etc, but I couldn't get better performance. I also checked that the Fortran compiler was not too smart to just skip the loop. My conclusion was that to get good performance, like with complex numbers, multidimensional arrays must be implemented as a language feature. Maybe, I'm completely wrong.

2) D performance for floating point operations is relatively slow compared to good C (not C++) and Fortran compilers. I would say, differences of 60-80% or even more in intensive loops are not unusual.

For those reasons, I'm just using Fortran95 with features of Fortran 2003 for now. By the way, new Fortran is not that bad. IMHO, it just lacks templates.

I think D is the best language for a lot of other applications. It would be nice if it could be the best for scientific applications, too.

Paulo
January 19, 2007
> I think D is the best language for a lot of other applications. It would be
> nice if it could be the best for scientific applications, too.
> 
> Paulo 

I agree, I wish something was done to fix these well known perforce holes in DMD.  Then it could even best languages like Fortran.  I think performance would be the best sales pitch for DMD.

-Joel
1 2 3
Next ›   Last »