Skip to content
This repository has been archived by the owner on Mar 2, 2021. It is now read-only.

Optimize removeSelfAndNextSiblings op #26

Open
fitzgen opened this issue Mar 2, 2019 · 0 comments
Open

Optimize removeSelfAndNextSiblings op #26

fitzgen opened this issue Mar 2, 2019 · 0 comments
Labels
performance Related to performance and profiling

Comments

@fitzgen
Copy link
Owner

fitzgen commented Mar 2, 2019

Probably slightly faster to use lastChild something like this:

    const node = changeList.stack.pop();
    const parent = node.parentNode;
    let last = parent.lastChild;
    while (last !== node) {
      last.remove();
      last = parent.lastChild;
    }
    // last === node
    node.remove();

than how we are currently using nextSibling.

@fitzgen fitzgen added the performance Related to performance and profiling label Mar 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
performance Related to performance and profiling
Projects
None yet
Development

No branches or pull requests

1 participant