4 ms·
I deleted my first question so that I could read on the subject a little to make sure the question wasn't a stupid one. After doing some reading I still have th
by fspeech 5y ago
I deleted my first question so that I could read on the subject a little to make sure the question wasn't a stupid one. After doing some reading I still have the same question so here it is again:
Does wasm app save memory significantly at runtime? If not why should one choose manual memory management outside of porting existing code?
- monocasa 5y agoI wouldn't imagine here that Rust's value add in this case is the memory management. Instead it's probably the strict and ergonomic control over constness (I prefer rust in that specfic context to js Object.freeze), the typesafe concurrency, and if you're the kind of crazy person that would use rust on the frontend in 2021 you probably are using it in the backend and you can therefore share code.
- brundolf 5y agoI could also see it helping with bundle size. Also, while uncommon, it's not impossible for VDOM rendering to be a performance bottleneck on complex apps. I used to work on one where we had enough components on the screen at a time that it was often a problem.
- verdagon 5y agoIIRC, functional programming already offered const-ness and type-safe concurrency. Do you think Rust might succeed here where FP couldn't really make much of an impact?
- monocasa 5y agoFP with typesafe concurrency hasn't really happened on the frontend yet in meaningful way. And I wouldn't frame it as Rust succeeding where FP failed, but instead a way to sneak in FP into the frontend in a way that gets really angry at you when you try to structure your code as mutable and imperative. Yes, most of the frontend languages let you opt in to constness and compile time typesafety, but Rust makes you opt out. It's soft developer thing, but it seems to have benefits to code quality from my experience.
- brundolf 5y agoFP isn't a technology, it's a way of using technology. You can follow it using JavaScript, or Rust, or Elm, or whatever. But JavaScript doesn't offer true constness (at least, not enforced). Elm does, but no JavaScript-targeted language (including Elm) has proper concurrency at all, type-safe or not (there are Workers, but they come with a bunch of caveats). Rust has good support for FP, type-safe concurrency (whether in an FP style or not), and mostly type-safe constness. Of course it also has its own set of tradeoffs, like anything else.
- skohan 5y agoIs typesafe concurrency a value-add in wasm? Isn't web mostly single-threaded?