Hacker News new | ask | show | jobs
by mvelbaum 536 days ago
Can you talk about about performance implications of using WASM?

1. The browser needs to load the whole app before anything else could be done resulting in a slow first load.

2. WASM -> DOM manipulation is slow.

1 comments

1: Actually, that's not true! I use Leptos in their "islands" mode for server side rendering. The entire page is sent as an HTML response, and there is little/no "hydration". The WASM file ONLY includes interactive "islands" that are explicitly marked with the #[island] attribute [0]. In other words, the server binary is handling most of the rendering, similar to if I used a templating tool like Askama or Tera.

2: Leptos is generally slower than vanilla JS, I believe for that reason, but comparable to major JS frameworks [1, 2].

[0]: https://book.leptos.dev/islands.html

[1]: https://krausest.github.io/js-framework-benchmark/current.ht...

[2]: https://leptos.dev/

What about event listeners that are supposed to listen to elements inside the islands? Like clicks, key ups, etc. Who handles that?