Am Sat, 26 Oct 2013 04:21:26 +0200
schrieb "deadalnix" <deadal...@gmail.com>:

> On Friday, 25 October 2013 at 07:50:36 UTC, ilya-stromberg wrote:
> > I think it's answer for your question. For example, Clang (LLVM 
> > C) is fastest, LDC (LLVM D) has 2-nd place, but LLVM-GHC (LLVM 
> > Haskell) ~ 2 times slower.
> 
> The explanation is quite simple. LLVM understand C and C++ 
> runtime. It doesn't understand D runtime (LDC is doing some work 
> in that regard, but it is still limited). So you see a difference 
> between C and C++ as some optimization will be done in C/C++ (for 
> instance heap to stack promotion) when it won't be done in D.

Some observations:
The posted level creation benchmark contains no dynamic memory
allocation and no runtime calls in the critical loop. As such
you won't lose performance due to missing compiler intrinsics
or the GC here and the runtime difference between the D and
the C version is minimal (< 0.5% in fact).

Yet I've altered it a bit to gain another 10% for the D
version (without changing the algorithm):
https://github.com/mleise/levgen-benchmarks/blob/master/D.d

Now D is the fastest again and we are all happy :)

-- 
Marco

Reply via email to