2 ms·
TypeScript: in all sane deployments, it’s translated to JavaScript at build time, so that the end user is just receiving normal JavaScript. If you eschew a few
by chrismorgan 4y ago
TypeScript: in all sane deployments, it’s translated to JavaScript at build time, so that the end user is just receiving normal JavaScript. If you eschew a few features that do generate some new JavaScript (e.g. enums), TypeScript compilation can even be as simple as just removing type annotations. For most practical purposes, TypeScript is just JavaScript. The end user doesn’t experience the “heavy machinery” to translate it to JavaScript.
Python: whether you use the likes of Brython (>5MB of JavaScript, though if you’re unrealistically careful—given the choice to use Brython—you may be able to whittle it down towards 1MB) or CPython compiled to WASM (mostly even larger, but of WASM rather than JS), performance is always going to be worse than reasonably-equivalent JavaScript or ahead-of-time-compiled WASM from languages like C++ or Rust. It’s fundamentally doing more work than alternatives, so it’ll always be heavier to download, slower to run, and more memory-hungry on equivalent code. It should never be used for web frontend stuff except when operating under extraordinarily unusual constraints, because it’s simply significantly worse in every way imaginable other than “is it more like Python than like JavaScript”.