Benchmarking suite

via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 9 02:56:08 PDT 2015


On Wednesday, 9 September 2015 at 07:59:48 UTC, qznc wrote:
> I'm not sure if I understand you correctly. What is "high 
> level" and "low level" optimization?

Low level are local optimizations, which basically will be the 
same if you use the same backend (like LLVM). It would just 
measure the programmer's approach and not the compiler.

> What I want to know is a) how fast is "idiomatic" D code (using 
> ranges etc) compared to "idiomatic" C/C++ and b) how do they 
> compare if you push performance to the limits (code beauty be 
> damned).
>
> For a) you want a similar implementation although C/C++ will 
> most certainly always loose in terms of length and convenience.
>
> For b) we don't care. C/C++ is free to use builtins, pragmas, 
> and whatnot. If for loops are faster than ranges in D, then we 
> will use for loops here.

The problem with a) is that in C++ there are many libraries and 
you'll have a hard time finding comparable alternatives on both 
sides... People don't stick to the standard libraries in C++.

For b) C++ will be slightly faster because of things like modular 
arithmetics and OpenMP support.

I think the better approach is to write up the same algorithms in 
a high level fashion (using generic templates on both sides) from 
the ground up using the same constructs and measure the ability 
to optimize.

Otherwise you end up comparing apples and oranges in a rather 
subjective manner.



More information about the Digitalmars-d mailing list