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

tracking issue for subtree memoization #39

Closed
jkelleyrtp opened this issue Dec 9, 2021 · 0 comments
Closed

tracking issue for subtree memoization #39

jkelleyrtp opened this issue Dec 9, 2021 · 0 comments
Labels
breaking This is a breaking change core relating to the core implementation of the virtualdom enhancement New feature or request

Comments

@jkelleyrtp
Copy link
Member

A major performance feature of Dioxus is complete elimination of static subtrees. So, subtrees within rsx! calls that have no dynamic calls can be "constified" and would be extremely cheap to generate.

This means that entirely-static structures like

                thead {
                    tr { class: "text-xs text-gray-500 text-left",
                        th { class: "pb-3 font-medium", "Transaction ID" }
                        th { class: "pb-3 font-medium", "Date" }
                        th { class: "pb-3 font-medium", "E-mail" }
                        th { class: "pb-3 font-medium", "Subscription" }
                        th { class: "pb-3 font-medium", "Status" }
                    }
                }

Would be completely skipped during the diffing process.

We can implement this today but there is some safety considerations to be aware of when hashing these structures. Primarily, if we compare two hashes and the second hash was manually created to be the same as another tree, then we would fail to update call functions for components, leading to missing state/unconnected lifetimes.

You would need to craft these structures intentionally, so it's extremely unlikely for any issue to pop up, but we don't want to directly expose a guaranteed way of causing UB into user code.

@jkelleyrtp jkelleyrtp added enhancement New feature or request core relating to the core implementation of the virtualdom breaking This is a breaking change labels Jul 7, 2022
@jkelleyrtp jkelleyrtp added this to To do in 0.3 Release Train Jul 7, 2022
@ealmloff ealmloff moved this from To do to Done in 0.3 Release Train Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This is a breaking change core relating to the core implementation of the virtualdom enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants