One document about Go

bearophile bearophileHUGS at lycos.com
Tue Jun 1 15:35:01 PDT 2010


Walter Bright:

>Firstly, this is not a back end vs front end issue. A compiler can do it in
either place, neither is inherently better than the other.<

You are right. This thread has gone in wrong directions.
What I meant was: Scala language is designed to use delegates often. For example the map maps a delegate on a collection, it never uses a string as Phobos2 map(). Scala compiler keeps its language efficent, despite all those delegates, because it contains a "large" amount of logic (separated from the large amount of optimization logic in the JavaVM itself) that allows it to often inline those delegates. LLVM developers have started to work on this problem too, and maybe eventually LLVM too (so LDC too) will enjoy some of such optimizations. The end result is that if you map a delegate on a Scala collection, it often gets inlined and this improves performance, while D LDC currently doesn't.


>Secondly, in what way does LLVM give better inline results?<

I am not a LLVM/LDC designer, and in the end I am pretty ignorant about compiler still. Until few days ago DMD didn't inline functions with ref arguments, while the inliner of llvm didn't have this limit, so this is place where LLVM was better. I'd like to give you more examples or a more detailed explanation, but I can't (maybe in D bugzilla there are more examples where the inliner fails, I don't know). Maybe LDC developers can give you a better answer. I find it funny that LDC devs seem to never talk about LDC here, I am not expert enough to talk about LDC, yet it seems no one else that knows more than me is talking about it here :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list