-
-
Notifications
You must be signed in to change notification settings - Fork 597
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
lazy loading and resumability ala qwik #12
Comments
Oh, totally! In fact one of the reasons the reactive system in this library uses index-based arena allocation is that it means the whole reactive system can be serialized and deserialized. I've experimented in the past with Qwik-style resumability in Rust. The main blocker right now is the Wasm bundle splitting story, which is not great. There's been some progress with the wasm-split tool from binaryen recently, and talk of integrating that with wasm-bindgen. So, Leptos isn't resumable at the moment but has been designed so far for future resumability. |
Very cool! I too have been eyeing wasm split with the idea of Qwik-style resumability. Hoping we can get that soon |
Is how qwik serializes events to HTML on the server side to client. They call this resumability |
Just wondering how feasible it is really... How does one do the same thing for rust functions? Seems to me that this is only a possibly valid approach for javascript and then again I jave doubt about the arguments that this is much better... The resumability approach, while interesting, seems to be at best an early optimization of app startup time. There are probably other tradeoffs. Just wondering there as I'm trying to see below the marketing. |
You don't need to serialize the functions, per se. You just need to know which signals are updated from which callback functions (this is by far the hardest part), and be able to code split such that you can load the correct function from Wasm as needed (this is also hard.) Qwik has put a ton of work into both of these things in a language they're much easier in.
You're 100% correct here. Qwik's team pushes resumability as the answer to every problem and the best thing ever. In reality, we can probably get a lot of the benefit with much-lower-hanging fruit like partial hydration/islands, and hybrid routing like Solid is working on right now. |
Well, part of why Qwik is able to not ship any javascript at startup is that they put the state in the Server Rendered HTML(including reactive functions I understand). But then the functions have to be serialized too. To be fair, I don't buy that as I think that most of the potential slowness is caused by third party scripts and not necessarily application code. But that's still one of the purported benefits of qwik that seems difficult to reproduce oustide of pure javascript. If the wasm has to be sent AND loaded separately very first thing anyway, I am a bit dubious about the true utility of implementing resumability in this case. If there is a solution for that, then why not of course. |
Resumability may have other advantages beyond just bundling/lazy loading, such as saving state in local storage. Even if you don't load the code as granularly as qwik, resumability still makes hydration a lot easier. |
Just curious, Qwik Optimizer is written in Rust. Is leptos reusing that? |
I don't think this would be plausible. Qwik's optimizer may be written in Rust, but it's a tool for doing static analysis of JavaScript files to do code extraction, etc. Some of the same principles may well apply to trying to build resumability into a Rust framework but the optimizer itself couldn't be reused in any meaningful sense, I don't think. |
I've built a prototype implementation of code splitting with lazy async loading for rust wasm32-unknown-unknown. See rustwasm/wasm-bindgen#3939 |
@jbms This is extremely good news. I've only skimmed your post so far but explicit module splitting is exactly what we need, not so much for resumability as for route-level code splitting, which would be fantastic. I will look at this more deeply. |
consider adopting ideas from qwik framework.
leverage seralization on the client to enable:
i believe qwik is bringing some inovative ideas into the web app world and since this project is still in early development you can still possibly incorporate them.
The text was updated successfully, but these errors were encountered: