Is dmd fast?

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 23 10:39:45 PDT 2016


Dne 23.6.2016 v 16:39 ketmar via Digitalmars-d napsal(a):

> On Thursday, 23 June 2016 at 13:32:35 UTC, Daniel Kozak wrote:
>> Or on linux use ld.gold instead of ld.bfd. Using .so instead of .a 
>> has another problem with speed. Application link against static 
>> phobos lib is much faster than against dynamic version.
>
> either i didn't understood you right, or... my tests shows that 
> ld.gold is indeed faster than ld.bfd (as it should be), but linking 
> against libphobos2.so is still faster in both linkers than linking 
> against libphobos2.a. it is ~100 ms faster, for both linkers.
>
> and if you meant that resulting application speed is different... tbh, 
> i didn't noticed that at all. i did no benchmarks, but i have 
> videogame engine, for example, and sound engine with pure D vorbis 
> decoding, and some other apps, and never noticed any significant 
> speed/CPU load difference between .a and .so versions.

Yes I was speaking about application speed or runtime overhead. Mainly 
about one shot scripts something like this:

//a.d
import std.stdio: writeln;

void main() {
     writeln("Ahoj svete");
}

[kozzi at samuel ~]$ dmd -defaultlib=libphobos2.so a.d
[kozzi at samuel ~]$ time for t in {1..1000}; do ./a; done > /dev/null

real    0m7.187s
user    0m4.470s
sys    0m0.943s

[kozzi at samuel ~]$ dmd -defaultlib=libphobos2.a a.d
[kozzi at samuel ~]$ time for t in {1..1000}; do ./a; done > /dev/null

real    0m1.716s
user    0m0.047s
sys    0m0.323s




More information about the Digitalmars-d mailing list