Hacker News new | ask | show | jobs
by pjmlp 70 days ago
Yes you can, and the dynamic nature means it will still be slower than strongly typed languages.

Asm.js was a political decision from Mozzilla that never accepted PNaCL, and was never as fast as Chrome's solution, hence why we have WebAssembly nowadays.

I rather have AI Rust -> Machine Code / WebAssembly.

1 comments

The point of an asm.js style is so that you can eliminate almost all of the dynamic variance so that ahead-of-time compilation is possible.

Asm.js can be transformed into whatever PNaCL takes to get even faster - there is no limit. Especially if someone were to say, write new enchancements to asm.js to restrict it even further.

It will be hell write that in pure JS of course, but that's beyond the point. You can use all manner of (unnatural) signals/semantics to indicate, for example, in-depth type information about a language construct.

It is hard when dynamic language users do very dynamic things. My whole point is, you have to be doing some very, very dynamic things to get into the 10x plus range in most cases.

For the Python, Ruby, Perl family of purely interpreted languages no doubt 10-100x is normal. For quality, lower-level JS no way. In those cases, they are usually reaching into features inaccessible to a JS runtime. It could also be due to a VM performance bug/limitation. As a compiler/transpiler guy, I could connect those gaps if shown the code - in variety of "creative" ways. ;)

> I could connect those gaps if shown the code - in variety of "creative" ways.

Why bother? It's better just to use a different language in the first place and get the performance for free.

Your argument is consistently "if only JavaScript was different then it would be faster".

That's wonderful but it isn't different. JavaScript is JavaScript. If you want performance you're better off with another language.

Porting to native disrupts the previous ecosystem. It's amazing when users of your software can modify it to fit their needs, in the same language.

Adding another barrier in the name of performance is justified only if your project actually hits hard limits. It's annoying when I hear these claims of JS is slow, then look at the code in questions (if it's public).

The code always has immediate problems. In some sense, maybe it is better to just switch languages then to challenge these assumptions.

> It's amazing when users of your software can modify it to fit their needs, in the same language.

But it doesn't fit their needs. It's too slow.