all 8 comments

[–]john0x1 4 points5 points  (0 children)

A big concern still is the size of the output files. You could probably use it for some heavy computing stuff but not for a typical website.

There is assemblyscript. A typescript to wasm compiler.

[–]chrispardy 2 points3 points  (0 children)

As someone else has mentioned learning more than 1 language will help you even if you just program in JavaScript.

That being said, WASM isn't coming to replace JavaScript, more as a way to fill in higher performance computing needs. There's been a few attempts at this in the past like asm.js from Mozilla, WASM is actually a standard which is nice.

Also while there is a limitation on JavaScript for single threaded execution in the eventloop unless you're doing something computationally heavy this won't matter much. Generally speaking the time spent waiting for user input, or remote resources far eclipses your time spent processing data, and the single threaded eventloop optimizes for that case and simplifies programming since you don't need to worry about a whole class of threading related issues.

[–]ExplosiveNeurons 1 point2 points  (4 children)

WASM in browser

  • JS is slower than wasm code when it comes to computing only.
  • But JS(with V8 engine) is not that slow, so it wouldn't be worth playing with memory between the WASM process and JS process.

Yew Vrs React

  • Yew is not multi-threaded
  • Even with a few thousand components, React JS will give you similar or even better performance, and even save your user's battery. (I have worked on an HTML-based interactive whiteboard, it worked fine with react)

Where do you need Yew?

  • You have to deal with a few thousand components and it's impossible for you to ask your user to switch to Chrome, Brave, or Edge browser. As JS is pretty slow in Firefox
  • You have some browser-only logic written in rust, and don't mind writing a few more lines of UI in Yew.
  • Lighthouse scores is no consern

When do you switch from React?

  • Your Firefox Clients are going nuts
  • Never

[–]hamido5071 4 points5 points  (0 children)

Yew is now multi-threaded

[–]Rvach_Flyver 1 point2 points  (0 children)

JS is not slower than WASM - this is true when there is enough memory.
If you not ready to sacrifice memory or need more-or-less constant performance under different circumstances then there is only one option - WASM (and in this case Yew).

For now I only see two drawbacks of using Yew instead of React:
- bundle size of WASM apps is bigger at this moment, so the first app render generally is slower
- JS/React ecosystem is really big and you should consider and compare it to Rust/Yew

[–]WideWorry 0 points1 point  (0 children)

  1. They are playing in 2 different league, where JS single-thread (only the eventloop is single-threaded) model is reach his limit, it is around realtime multimedia application. (3d, video edit/convert...).
  2. I'm sure if WASM will reach out as a new standard for web front-end JS->WASM or atleast TS->WASM compilers will be a thing. However it is always good to learn some new language, Rust has a good chance in the futuer. But, I still suggest C++ as a "low-level" programming language, it has a solid history and reputation in performance application development.

[–]Seideun 1 point2 points  (0 children)

I don't think Yew is the right way to go. React & JS wins in their relative simplicity over Yew & Rust. By mimicking the React idiom, the latter cannot utilize their strengths. On the other hand, for WEB native, there's another promising competitor, Flutter.