On 10/23/2013 02:26 PM, Kai Nacke wrote:
On Wednesday, 23 October 2013 at 17:45:50 UTC, John Joyus wrote:
On 10/22/2013 06:42 PM, David Nadlinger wrote:
LDC 0.12.0, the LLVM-based D compiler, is available for download!
Congratulations!
I am a D enthusiast who reads more *about* D than actually learning
the language! ;)
I have a question about LLVM.
When it comes to performance, do all LLVM-based languages eventually
match each other in speed for any given task, no matter it is Clang or D?
I guess having or not having a GC (or different implementations of it
in different languages) will make a difference, but if we exclude GC,
will they be generating the same exact code for any given operation?
It depends. If 2 language frontends generate the same IR then LLVM
generates the same exact code. But in general you have different
languages features therefore the IR differs, too. (C++ classes are not
available in C, C++ multiple inheritance in not available in D, D slices
are not available in C++, ...)
If the generated IR is too "stupid" then even the LLVM optimizer can't
help (e.g. look at the now solved issue #119
https://github.com/ldc-developers/ldc/issues/119).
And a functional language like Haskell is likely to generate totally
different IR.
In other words, though two different languages are based on LLVM, can
one of its binary exceed the other in speed?
Yes.
Thanks Kai,
It's good to know that "smart" developers can develop better compilers
with the same IR available to all.