Skip to content
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

Erased routing, codegen opts #3623

Merged
merged 9 commits into from
Feb 18, 2025
Merged

Conversation

zakstucke
Copy link
Contributor

@zakstucke zakstucke commented Feb 16, 2025

There's a few things in here (sorry!), to sum up:

  • Routing is erased, most importantly this should (probably) solve any remaining compile errors in rust debug/dev builds
  • The view!{} macro now erases thoroughly
  • A few more hot codegen optimisations of existing logic in traits
  • erased containers define their fn() functions with concrete fn foo declarations rather than closures, TIL this is more codegen efficient
  • The erased crate is used as a replacement for Box<dyn Any> in erased containers, which is more efficient and (I think) avoids a massive dyn Any vtable
  • IntoFragment contains StaticVec instead of a Vec

This shouldn't have any breaking changes.

@zakstucke zakstucke marked this pull request as draft February 16, 2025 09:33
@zakstucke
Copy link
Contributor Author

zakstucke commented Feb 16, 2025

This is almost finished, there's a second part that somehow breaks leptos, which I need to fix, but I've found the change that breaks it (not in here), I'll fix it then finish this in like 8 hrs
But after this PR, there's an erase internals of Either PR, which I'll only open if it actually benchmarks gains after this one, then the erasure journey's complete I think

@zakstucke zakstucke marked this pull request as ready for review February 16, 2025 21:47
@zakstucke
Copy link
Contributor Author

Should be ready to go, updated description.

@zakstucke
Copy link
Contributor Author

zakstucke commented Feb 16, 2025

Happy to say my Either enum internal erasure PoC, on top of everything else, only provides a minimal codegen optimisation (~1%), pretty much because everything it holds is already erased, so is not worth the breaking change and weirdness of a variant that is actually a function (to handle vari-erasure) etc.

This means (I think) the erasure journey is now complete 🎉

@benwis
Copy link
Contributor

benwis commented Feb 17, 2025

This looks good to me, I'll let @gbj take a look before we merge this. Super excited!

@benwis benwis merged commit 49e44a2 into leptos-rs:leptos_0.8 Feb 18, 2025
73 of 74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants