D => asm.js for the web?

John Colvin john.loughran.colvin at gmail.com
Sat Mar 23 04:32:34 PDT 2013


On Saturday, 23 March 2013 at 02:39:55 UTC, H. S. Teoh wrote:
> On Sat, Mar 23, 2013 at 03:34:54AM +0100, Adam D. Ruppe wrote:
>> On Saturday, 23 March 2013 at 02:20:33 UTC, bearophile wrote:
>> >I think someone will be happy to use D instead of C/C++ on 
>> >the web
>> >for performance-sensitive code, like games.
>> 
>> If it compiles to any kind of javascript it is a mistake to 
>> think
>> they'll be a performance boost over just writing javascript, 
>> with or
>> without annotations. Odds are there will be leaky abstractions 
>> in
>> the compile process that can hurt speed.
>
> Any kind of translation from language X to language Y will 
> incur at
> least the performance overhead of language Y, plus some 
> incidental
> overhead incurred by non-trivial or imperfect mapping of X's 
> features to
> Y'es features. This incidental overhead is rarely every zero.
>
> So there is no way translating from language X to language Y 
> will be
> faster than writing in language Y in the first place, no matter 
> how good
> your optimizer is. Otherwise, you might as well just write in 
> language Y
> to begin with, and run the optimizer on *that*.
>

I don't think you understood the point. asm.js is not the same as 
js. Pure js isn't involved anywhere along the translation path 
bearophile proposed except as a side-effect.


More information about the Digitalmars-d mailing list