by FridgeSeal · 2y ago · 0 comments
https://web.dev/case-studies/google-sheets-wasmgc
Any application that is written in JavaScript will have more and more of it replaced with WebAssembly.
Which is not a lot when it comes to web. Sure some algo heavy stuff like Figma will benefit from it, but GUI around it is still written in what?
Works for Dart with Flutter:
https://www.youtube.com/watch?v=Nkjc9r0WDNo
https://www.youtube.com/watch?v=qx42r29HhcM
Works for C# with Avalonia UI:
https://www.youtube.com/watch?v=6mwQDPlbF5Y
And so on.
If you write non-portal code, there might be an important reason (like writing OS components, which you won't do in JS).
javascript doesn’t have a compiler is my main point.
Take a look at rollup, vite, etc. These tools are essentially replacing webpack, which is written in JS. Modern Rollup (^4) uses SWC (Rust-based bundler), and vite is currently using a mix of esbuild (Go) and Rollup. I think they're switching to SWC in v6 though.
The point here is that for certain operations JS is not nearly as fast as lower-level languages like the aforementioned. Bundling is one of those performance-critical areas where every second counts.
That said, as a TypeScript developer I agree with the sentiment that JS tools should be written in JS, but this isn't a hard and fast rule. Sometimes performance matters more. I think the reasonable approach is to prefer JS – or TS, same difference – for writing JS tools. If that doesn't work, reach for something with more performance like Rust, Go, or C++. So far I've only had to do the latter for 2 use cases, one of which is hardware profiling.
Though I don't see an issue with tools for JS built without JS. It's just that I don't think that it's a bad thing for a JavaScript dev to want the ecosystem around JavaScript to be written in JS. JS is orders of magnitudes faster than python in any case.
The JStockholm syndrome.