D perfomance
Les De Ridder
les at lesderid.net
Fri Apr 24 23:03:25 UTC 2020
On Friday, 24 April 2020 at 22:52:31 UTC, IGotD- wrote:
> On Friday, 24 April 2020 at 19:27:40 UTC, Arine wrote:
>>
>> 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
>>
>>
>
> Would DIP 1000 enable such optimization possibility in D?
Technically DIP 1021 could.
More information about the Digitalmars-d
mailing list