3 ms·
>more enthralling languages to choose from that transpile neatly to JS Many of those languages you listed (for example, TypeScript) run slowly compared to plai
by flavio81 9y ago
>more enthralling languages to choose from that transpile neatly to JS
Many of those languages you listed (for example, TypeScript) run slowly compared to plain Javascript. Transpiling to js is not an easy task and I don't think one can claim it can be done in a "neat" way; see for example the paper that Emscripten authors wrote regarding that topic.
Why should I accept a performance penalty if I write in TypeScript, being so similar to JS? TypeScript is js with typing support. In the outside world (outside of the js ecosystem), if you have a dynamically typed language and you add type annotations to it, performance gets boosted dramatically, 3x to even 10x speed (practical example: Lisp). Not in the case of Typescript. It goes slower than js. Why? Because transpiling to js isn't so nice.
Those langs, compiled to Webassembly, should work much faster, and many will outperform Javascript substantially. Even in simple stuff: Javascript only has floating point numbers. There is a lot of computationally intensive code that will massively outperform the JS equivalent, if implemented using Webassembly using plain integers.
- dualogy 9y ago> Why should I accept a performance penalty if I write in TypeScript, being so similar to JS? TypeScript is js with typing support Indeed you shouldn't. TS set out to be "JS with types, that get checked then ditched". Has it morphed into something more? The above shouldn't be slow to generate. And as for code speed, not much code-gen should be happening in the first place once type info is erased from source as "TS turns into JS". I might not be fully up to speed on TS' latest developments however.