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

Improve hydration by reordering optimally #6395

Merged
merged 4 commits into from
Jun 22, 2021

Commits on Jun 19, 2021

  1. Implement new hydration optimization

    During hydration, greedily pick nodes that exist in the original HTML that should not be detached.
    Detach the rest.
    hbirler committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    8e1183b View commit details
    Browse the repository at this point in the history
  2. Implement optimal reordering during hydration

    During hydration we track the order in which children are claimed.
    Afterwards, rather than reordering them greedily one-by-one, we reorder all claimed children during the first append optimally.
    The optimal reordering first finds the longest subsequence of children that have been claimed in order.
    These children will not be moved.
    The rest of the children are reordered to where they have to go.
    This algorithm is guaranteed to be optimal in the number of reorderings.
    
    The hydration/head-meta-hydrate-duplicate test sample has been modified slightly.
    The order in which the <title> tag is being generated changed, which does not affect correctness.
    hbirler committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    d97e835 View commit details
    Browse the repository at this point in the history
  3. Fix issue potentially causing extra reorders

    Not sorting children before executing the `insertBefore` calls in `init_hydrate` potentially caused extra `insertBefore` calls in `append`
    hbirler committed Jun 19, 2021
    Configuration menu
    Copy the full SHA
    1c80db0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8baf905 View commit details
    Browse the repository at this point in the history