www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D postmortem

reply Walter Bright <newshound1 digitalmars.com> writes:
Unfortunately, the article itself has gone down, but the comments are up:

http://www.reddit.com/r/programming/info/6ogl6/comments/
Jun 22 2008
next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
The article comes up if you click the link at the top "D Postmortem"

At least *an* article comes up, not sure if thats the one you were talking 
about :)

-Steve

"Walter Bright" wrote
 Unfortunately, the article itself has gone down, but the comments are up:

 http://www.reddit.com/r/programming/info/6ogl6/comments/ 
Jun 23 2008
prev sibling parent reply Robert Fraser <fraserofthenight gmail.com> writes:
Walter Bright Wrote:

 Unfortunately, the article itself has gone down, but the comments are up:
 
 http://www.reddit.com/r/programming/info/6ogl6/comments/
It was repeated in one of the comments. I agree with everything there, except the fact taht no steps are being taken to solve the paralellism problem. D is taking steps, although whether those are the correct steps is a different question entirely.
Jun 23 2008
parent reply bearophile <bearophileHUGS lycos.com> writes:
I was reading this thread:
http://www.reddit.com/r/programming/info/6ogl6/comments/

And it contains this:
WalterBright:
 I'm not sure what you're encountering with the struct return code. The D
compiler does the named value return optimization, the same as C++. It will
also return small structs in registers, as C++ compilers do. If you could email
me (or put on bugzilla) an example of the problem, I can comment more.<
Stuct/classes usage in DMD is much slower than the same performed in C++ with MinGW. After two days of benchmarks I have found a way that allows enough speed (and later I have written around that solution the tinyvect module you can find in my libs). import d.func: Lets2; struct Vec(TyDato, int n) { TyDato[n] data; void opAddAssign(Vec!(TyDato, n)* other) { mixin( Lets2!("this.data[%s] += other.data[%s];", n) ); } } You have to allocate them like this, with a new: auto v = new Vec!(long, 3); The Lets2!() template generates n assignment lines at compile time, according to the fixed size of the array. Every other way I have tried (about 30 different designs, I think) is 1.3-4 times slower, so if you need such speed you can't use classes, etc. But designing the struct this way doesn't allows to use operation overloading, I think. Bye, bearophile
Jun 24 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
bearophile wrote:
 And it contains this: WalterBright:
 I'm not sure what you're encountering with the struct return code.
 The D compiler does the named value return optimization, the same
 as C++. It will also return small structs in registers, as C++
 compilers do. If you could email me (or put on bugzilla) an example
 of the problem, I can comment more.<
Stuct/classes usage in DMD is much slower than the same performed in C++ with MinGW.
Can you look at the asm output and identify a case where it is less efficient?
Jun 24 2008
parent bearophile <bearophileHUGS lycos.com> writes:
Walter Bright:
 Can you look at the asm output and identify a case where it is less efficient?
You are right, I have cleaned my code up a bit, removing too much silly experiments. This is just a first version, if you need something different I'll try to show something different: http://rafb.net/p/TDxobC64.html Its asm: http://rafb.net/p/16MemX81.html The timings at the end are done on a dual core at 2 GHz with DMD V.1.029 (I can't use the two successive versions). I think efficiency losses come from many different sources, so it may be difficult to spot a single small thing to be fixed. (But DMD is a young language, at the beginning Java too was really inefficient, so for now I agree that it's better to focus most work on developing the language. Efficiency issues are mostly for later). Thank you, bearophile
Jun 24 2008