Re:D is being used for autonomous driving research – Audi an...
by mhh__ on Tuesday June 25, 2019 @01:26PM
(#20276593)
It's a completely meaningless comparison in practice.
D's contract mechanism (i.e. in/out, and invariant blocks) can provide very strong guarantees to the compiler (as a specified part of the language as opposed to a GCC pragma/builtin), which the LLVM D compiler definitely uses.
All of the on by defaults that D has are usually there for a reason, i.e. floats are NaN initialized and bounds checking is on by default: These are very good idiot-proofing which can often be ignored unless profiling suggests there is a tangible issue.
Re:D is being used for autonomous driving research – Audi an...
by EvenThisAcronym on Friday June 28, 2019 @01:11PM
(#20306544)
> D's contract mechanism [...] can provide very strong guarantees to the compiler... which the LLVM D compiler definitely uses.
That's awesome. I didn't know LDC uses contracts like that. It'd be nice to have similar functionality across all D compilers.
That's not necessarily true.
For example language semantics (essentially how much information the optimiser has) such as whether mutable pointers are allowed to alias (or even the existence of non-mutable pointers) can play a huge role in what optimisations can be applied in a given situation and even how effective certain optimisations are. Also default behaviours like D, rust, and nim doing bounds-check can change the practical speed (although not necessarily theoretical speed) of a language. And finally things like garbage collectors can make certain languages faster in some cases but slower in others (again there's a practical vs theoretical argument here, since you could get similar speed-ups using other techniques).
So no they don't necessarily have to have comparable performance, at least not in all situations.