View mode: basic / threaded / horizontal-split · Log in · Help
November 10, 2006
Increasing speed of D applications to Intel C compiled applicaitons' standards
My personal benchmarks prove that applications written in D are 5%
to 20% slower than identical code written in C and compiled with
Intel C compilter 9. Does anyone know what to do with this
problem? Is it a compiler specific problem (ie: D compiler lacking
all the optimisation parameters) or the standard d libary or
what??

Any information/idea would be appriciated. Before starting a big
project, speed issues with D seems to be the biggest obstacle to
overcome.

Teoman Soygul,
Alsoft.
November 10, 2006
Re: Increasing speed of D applications to Intel C compiled applicaitons' standards
Teoman Soygul wrote:
> My personal benchmarks prove that applications written in D are 5%
> to 20% slower than identical code written in C and compiled with
> Intel C compilter 9. Does anyone know what to do with this
> problem? Is it a compiler specific problem (ie: D compiler lacking
> all the optimisation parameters) or the standard d libary or
> what??
> 
> Any information/idea would be appriciated. Before starting a big
> project, speed issues with D seems to be the biggest obstacle to
> overcome.

If it's identical code, then it's a compiler optimization issue, as 
identical C code compiled with D should produce identical results. You 
can try using the D profiler to see if the slowdown is in any specific 
place.

5% to 20% are generally not big obstacles to overcome, as they are often 
in one or two spots that can be hand optimized (or written in 
assembler). It's also my experience that until it reaches 2:1, few 
people even notice it. Even the same program will vary 5 to 10% in 
execution time from run to run.
November 10, 2006
Re: Increasing speed of D applications to Intel C compiled applicaitons' standards
Teoman Soygul wrote:
> My personal benchmarks prove that applications written in D are 5%
> to 20% slower than identical code written in C and compiled with
> Intel C compilter 9. Does anyone know what to do with this
> problem? Is it a compiler specific problem (ie: D compiler lacking
> all the optimisation parameters) or the standard d libary or
> what??
> 
> Any information/idea would be appriciated. Before starting a big
> project, speed issues with D seems to be the biggest obstacle to
> overcome.
> 
> Teoman Soygul,
> Alsoft.

I think even Microsoft's compiler is 5-20% slower than the Intel's 
compiler, depending on the particular code in question (particularly SSE 
optimizeable things).  So I don't think this speed difference is 
something to be so worried about.

Still, there's a big difference between 5% and 20%.  Do you have any 
observations about what sorts of things put you in the 20% category?

--bb
November 10, 2006
Re: Increasing speed of D applications to Intel C compiled applicaitons' standards
Teoman Soygul wrote:
> My personal benchmarks prove that applications written in D are 5%
> to 20% slower than identical code written in C and compiled with
> Intel C compilter 9. Does anyone know what to do with this
> problem? Is it a compiler specific problem (ie: D compiler lacking
> all the optimisation parameters) or the standard d libary or
> what??
> 
> Any information/idea would be appriciated. Before starting a big
> project, speed issues with D seems to be the biggest obstacle to
> overcome.
> 
> Teoman Soygul,
> Alsoft.

One thing you might want to do is to also compare with C code compiled 
using the Digital Mars C compiler since dmd and dmc use the same back 
end.  This should help clarify what's due to inherent differences in the 
languages and what's just differences in compiler optimization.

--bb
November 10, 2006
[More Info] Increasing speed of D applications to Intel C compiled applicaitons' standards
"Do you have any observations about what shorts of things put you
in the 20% category?"

- Luckly the code requiring sheer processing power like math
functions(trigs, logs...), b-tree creation, compression, D code
runs only 5-6% slower (an averaged mean) compared to Intel C
compiler.
- Unfortunately, processes requiring sheer memory access like
memcopy, mem alloc, de-alloc, stream copy is nearly almost 15->20%
slower at D. (note that, code is totally identical).

I'll post these results on my blog once I put them into a good
graphed format so we can discuss it even further. with my limited
knowledge on compilers, what i've seen is that intel c compiler
has many ingenious optimisations. maybe there can be a way to put
the same ideas into D compiler. (i hope)
November 10, 2006
Re: Increasing speed of D applications to Intel C compiled applicaitons' standards
Teoman Soygul wrote:
> My personal benchmarks prove that applications written in D are 5%
> to 20% slower than identical code written in C and compiled with
> Intel C compilter 9. Does anyone know what to do with this
> problem? Is it a compiler specific problem (ie: D compiler lacking
> all the optimisation parameters) or the standard d libary or
> what??

If you can, try to profile the code and see where the difference lies. 
How long does the application run, is the code identical, etc?  5% for a 
very short-running app could be attributed to the garbage collector 
initialization and termination, for example, but this wouldn't be a 
factor in longer running apps.


Sean
November 10, 2006
Re: [More Info] Increasing speed of D applications to Intel C compiled applicaitons' standards
%u wrote:
> - Unfortunately, processes requiring sheer memory access like
> memcopy, mem alloc, de-alloc, stream copy is nearly almost 15->20%
> slower at D. (note that, code is totally identical).

Keep in mind that D's allocator includes a garbage collector. To really 
do an apples-to-apples comparison, your benchmarking code should create 
lots of temporary objects. In D, the GC will handle all allocations and 
de-allocations. In C++, your objects will have to be manually created 
and destroyed.

I'd be more interested in those kinds of benchmarks than in the kinds of 
micro-benchmarks that just compare the speed of D allocation with the 
speed of C++ allocation.

--benji
November 10, 2006
Re: [More Info] Increasing speed of D applications to Intel C compiled applicaitons' standards
%u wrote:
> "Do you have any observations about what shorts of things put you
> in the 20% category?"
> 
> - Luckly the code requiring sheer processing power like math
> functions(trigs, logs...), b-tree creation, compression, D code
> runs only 5-6% slower (an averaged mean) compared to Intel C
> compiler.
> - Unfortunately, processes requiring sheer memory access like
> memcopy, mem alloc, de-alloc, stream copy is nearly almost 15->20%
> slower at D. (note that, code is totally identical).

Some of this may be related to DMC's C library implementation vs. 
Intel's.  Could you try the app using DMC and compare it to DMD?


Sean
November 10, 2006
Re: Increasing speed of D applications to Intel C compiled applicaitons' standards
== Quote from Bill Baxter (wbaxter@gmail.com)'s article
> Teoman Soygul wrote:
> > My personal benchmarks prove that applications written in D
are 5%
> > to 20% slower than identical code written in C and compiled
with
> > Intel C compilter 9. Does anyone know what to do with this
> > problem? Is it a compiler specific problem (ie: D compiler
lacking
> > all the optimisation parameters) or the standard d libary or
> > what??
> >
> > Any information/idea would be appriciated. Before starting a
big
> > project, speed issues with D seems to be the biggest obstacle
to
> > overcome.
> >
> > Teoman Soygul,
> > Alsoft.
> One thing you might want to do is to also compare with C code
compiled
> using the Digital Mars C compiler since dmd and dmc use the same
back
> end.  This should help clarify what's due to inherent
differences in the
> languages and what's just differences in compiler optimization.
> --bb

Comparing Digital Mars C to Intel C really is a good idea to see
if the performance difference is about D & C or D compiler and C
compiler. I'll do that comparison also and post it so we can
evaluate.
November 10, 2006
Re: [More Info] Increasing speed of D applications to Intel C compiled applicaitons' standards
%u wrote:
> "Do you have any observations about what shorts of things put you
> in the 20% category?"
> 
> - Luckly the code requiring sheer processing power like math
> functions(trigs, logs...), b-tree creation, compression, D code
> runs only 5-6% slower (an averaged mean) compared to Intel C
> compiler.
> - Unfortunately, processes requiring sheer memory access like
> memcopy, mem alloc, de-alloc, stream copy is nearly almost 15->20%
> slower at D. (note that, code is totally identical).
> 
> I'll post these results on my blog once I put them into a good
> graphed format so we can discuss it even further. with my limited
> knowledge on compilers, what i've seen is that intel c compiler
> has many ingenious optimisations. maybe there can be a way to put
> the same ideas into D compiler. (i hope)


so are we talking about a GC issue? I think it would be interesting to 
use D for a front end to C . Then basically D code could be ran through 
the Intel optimizer.
« First   ‹ Prev
1 2
Top | Discussion index | About this forum | D home