Language Shootout

kris foo at bar.com
Fri Mar 30 15:16:57 PDT 2007


Dan wrote:
> Wow...
> 
> The pages actually are quite different than the last time I saw them.  Maybe someone recently submitted some code, or maybe, yeah their site was broken?
> 
> Regardless, it shows that D's 2.2x slower than GCC (and GDC?) on recursion, which is bad.  I would guess that the function call overhead alone is sufficient to taint the benchmarks away in C's favor.
> 
> Also, yeah, we probably should have a class-less implementation of everything if we care about speed.  
> 
> Classes are inefficient, and unnecessary IMHO - structs can have static methods and constructors/destructors too.  Only remaining thing is inheritance and interfaces.

IMO, classes are as you describe them only when badly abused :)

There are also times when a class is used rather than a struct, for the 
sake of consistency and/or due to the lack of a struct ctor construct in D.

For example, there are a two or three cases in Tango where this occurs, 
such as the Random aggregate. Would be great to get sorted out with a 
struct ctor, but in the meantime those instances will remain as classes 
since the syntax will likely still be valid when structs become further 
endowed (we hope)

2c



More information about the Digitalmars-d mailing list