-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Virtual DOM is too coupled to Yew Framework #758
Comments
Is there anyway for yew to not use virtual DOM like dominator? What are the implications of not using it? It felt like GC (initial rust) vs no GC (current rust) to me. |
Everything in Yew is pretty tied to the virtual DOM, but I've been trying to think of ways to move away from using a virtual DOM. |
I don't how svelte does it but they created a declarative javascript language that gets compiled to efficient vanilla js imperative code with no virtual dom. I would imagine looking inside the svelte's compiler as a starting point to go from rust+wasm to efficient vanilla js with wasm |
The problem with going that way in WASM is that making DOM API calls is more expensive than querying in-memory VDOM. For write operations to the DOM, this isn't an issue but for read operations (such as for diffing, etc), this can cause performance issues. |
The alternative to diffing with a virtual DOM isn’t diffing with the real DOM. (Well that is an alternative, but yes, it’d be very slow.) The way the fastest modern JS frameworks work is by remembering the graph of dependencies from individual DOM nodes to individual pieces of reactive state, and using it to directly update only the affected DOM nodes when some of the state changes. This of course has implications for the API, which has to be adjusted to allow these dependencies to be tracked. This ten-minute SolidJS introduction is worth watching to understand how that could work in practice. |
Description
Yew's Virtual DOM implementation is too coupled to the framework and should be moved to a different crate if possible. This would allow other backends to be used with Yew in the future.
The text was updated successfully, but these errors were encountered: