D to ASM.js vs D to Dart (VM)

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sun May 18 00:55:04 PDT 2014


On Friday, 16 May 2014 at 06:46:08 UTC, Jacob Carlborg wrote:
> On 16/05/14 00:16, Etienne wrote:
>
>> Templates are compile-time, a D compiler always takes care of 
>> all its
>> compile-time duties =)
>
> Unfortunately it does not. It causes unnecessary bloat. Take 
> this for example:
>
> void foo (T) (T t);
>
> foo(new Foo);
> foo(new Bar);
>
> This will generate two functions, even though the machine code 
> is exactly the same for both.

If the machine code is the same, the function can be merged by 
the optimizer.


More information about the Digitalmars-d mailing list