bearophile schrieb: > Scorn: > >> But D as a system-programming language with the ambition to be an >> alternative to C / C++ has, at least in the long term, to compete with C / >> C++ regarding these things.< > > I understand. The problem is that D is a new language with new compilers, so > it can't optimize as well as GCC that is compiling C code for so many years. > LDC compiles C-like D1 code well enough, about as well as GCC or better. > >
Sure. And that is something i do not expect yet. Since Walther is doing nearly all the compiler work alone, i would never ever blame him for anything. And it's not that i am not willing to sacrifice speed for the productivity gains which programming in D gets me. But it's always annoying when simple things like this do not seem to work. Things which work in virtually every other compiled language out there. This sometimes costs a lot of confidence in the compiler. >> And please make a collection of all the issues you have found so far and but >> them on a web page somewhere.< > > http://www.fantascienza.net/leonardo/js/slow_d.zip > This test code is very nice. But some kind of web page where you a collection of all the performance problems you found so far in the D compiler would be great. So nothing of your research would get lost. > >> Which compiler switches do you need for this ?< > > Found after few hours of tests of mine plus a suggestion from the LLVM lead > developer :-) > For example you have a "temp.d" main module and a "mo.d" imported module: > > ldc -O5 -release -inline -output-bc temp.d > > ldc -O5 -release -inline -output-bc mo.d > > opt -std-compile-opts temp.bc > tempo.bc > > opt -std-compile-opts mo.bc > moo.bc > > llvm-ld -L/usr/lib/d -native -ltango-ldc -ldl -lm -lpthread > -internalize-public-api-list=_Dmain -o=tempo tempo.bc moo.bc > > >> But the whole thing is easy solvable by not doing just a separate >> compilation of the modules and then linking them together< > > If you take a look at my precedent post ( > http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=18822 > ) you can see I have found DMD does inline functions from other modules > (while LDC doesn't do it, so I have to report this to the ldc devs and not to > Walter). > These are good news. But hopefully the compiler does it not only for your test case but tries always to inline functions across modules when it is worth it (which was the purpose of the original question). Is it constrained by the size of the function or the parameters. Trass3r did some nice research regarding this. > Bye, > bearophile Thanks for your hints, Bye.
