This algorithm, while adding about 200bytes to the minzipped size, should improve performance with a focus on the main setup a website should have: head elements that may be numerous in number, are generally laid out in the same order with limited difference.
This, in a happy scenario (no changes) does one comparison for child of the head. Total comparisons should be something like #matchingNodes + 2(#staleNodes * #freshNodes), which should be improved over the old algorithm comparison count of n! for even the happy path.
This PR:
This algorithm, while adding about 200bytes to the minzipped size, should improve performance with a focus on the main setup a website should have: head elements that may be numerous in number, are generally laid out in the same order with limited difference.
This, in a happy scenario (no changes) does one comparison for child of the head. Total comparisons should be something like
#matchingNodes + 2(#staleNodes * #freshNodes)
, which should be improved over the old algorithm comparison count ofn!
for even the happy path.