|
|
|
|
|
by readittwice
3388 days ago
|
|
I am not sure what you mean? Both Python (PyPy) and Dart have a JIT (yes, you can also compile Dart to JS), so they don't lose type information in those VMs. See what the PyPy-Devs have to say about type annotations and performance (they have a faq entry for that!): http://doc.pypy.org/en/latest/faq.html#would-type-annotation...
And here is what the Dart devs have to say: https://www.dartlang.org/faq#q-but-dont-you-need-sound-typin... Your claim was "it probably wouldn't take that much effort to surpass JS performance with a custom TypeScript -> WASM compiler" I guess you basically have two options: 1) Implement a JS-Engine on top of WASM. Which is a lot of work. But what could you do to get better performance than current JS-Engines? Every optimization you can implement on top of WASM, you can also implement for native JS-Engines. Quite the contrary it is even harder, since you are an abstraction layer higher and can only make use of WASM opcodes. 2) Define a fully-statically typed subset of Dart and compile to WASM. You could sure do that, but don't forget about e.g. the ubiquitous number type in JS/TS. You may have to use double (almost) everywhere if you want to match semantics of JS. How many non-trivial TypeScript programs could such a subset run successfully? I assume not a lot. I don't see how you could write a TypeScript to WASM compiler without much effort. Care to explain? |
|