D perfomance

Arine arine1283798123 at gmail.com
Thu Apr 23 15:13:08 UTC 2020


On Thursday, 23 April 2020 at 11:05:35 UTC, drug wrote:
> 23.04.2020 01:34, Arine пишет:
>> On Wednesday, 22 April 2020 at 15:24:29 UTC, welkam wrote:
>>> On Wednesday, 22 April 2020 at 14:00:10 UTC, serge wrote:
>>>> My understanding that D is the language in similar ballpark 
>>>> performance league as C, C++, Rust.
>>> Equivalent implementation in C, C++, D, Rust, Nim compiled 
>>> with same compiler backend should give exact same machine 
>>> code. What you see in online language comparisons is mostly 
>>> comparing different implementations and how much time people 
>>> spent on optimizing.
>> 
>> Not quite. Rust will generate better assembly as it can 
>> guarantee that use of an object is unique. Similar to C's 
>> "restrict" keyword but you get it for "free" across the entire 
>> application.
>
> You forget to add "in some cases Rust may generate better 
> assembly than C/C++/D because..." But this is not the answer to 
> the question OP asked. Rust has llvm based backend like ldc so 
> nothing prevents ldc to be as fast as any other llvm based 
> compiler. Nothing. The question is how many efforts you put 
> into it.

I wasn't replying to the author of the thread. I was replying to 
a misinformed individual in the thread.

If that's the way you want to think about, you can create your 
own compiler and language. "It's just about how many efforts you 
put into it", even if that means making your own language and 
compiler. How much "efforts" you have to put into something is a 
factor in that decision. You'd basically have to remake Rust in D 
to get the same assembly results and guarantee regarding aliasing.


More information about the Digitalmars-d mailing list