Page MenuHomePhabricator

Investigate perf problems with nextSibling (with / without DOM mutations) in domino
Closed, ResolvedPublic

Description

Domino is exhibiting poor (O(n^2) behavior?) for the commonly used node.nextSibling property.

In Parsoid, the findIndentPres uses a for-loop to traverse the DOM whereas the cleanupFormattingTags uses a nextSibling (in presence of mutations) and migrateTrailingNLs uses a previousSibling (in presence of mutations).

On a test page where there are no mutations, each of those passes are taking different times to visit the entire DOM. nextSibling is taking substantially longer compared to the other two.