D perfomance

Arine arine1283798123 at gmail.com
Fri Apr 24 19:27:40 UTC 2020


On Thursday, 23 April 2020 at 15:57:01 UTC, drug wrote:
> And your statement that Rust assembly output is better is wrong.

https://godbolt.org/z/g_euiT

D:

     int foo(ref int a, ref int b) {
         a = 0;
         b = 1;
         return a;
     }

int example.foo(ref int, ref int):
         movl    $0, (%rsi)
         movl    $1, (%rdi)
         movl    (%rsi), %eax
         retq

Rust:

     pub fn foo(x: &mut i32, y: &mut i32) -> i32 {
         *x = 0;
         *y = 1;
         *x
     }

example::foo:
         mov     dword ptr [rdi], 0
         mov     dword ptr [rsi], 1
         xor     eax, eax
         ret


There most definitely is a difference and the assembly generated 
with rust is better. This is just a simple example to illustrate 
the difference. If you don't know why the difference is 
significant or why it is happening. There are a lot of great 
articles out there, sadly there are people such as yourself 
spreading misinformation that don't know what a borrow checker is 
and don't know Rust or why it is has gone as far as it has. This 
is why the borrow checker for D is going to fail. Because the 
person designing it, such as yourself, doesn't have any idea what 
they are redoing and have never even bothered to touch Rust or 
learn about it. Anyways I'm not your babysitter, if you don't 
understand the above, as most people seem to not bother to learn 
assembly anymore, you're on your own.







More information about the Digitalmars-d mailing list