MobileFormatter has quadratic performance: the time it takes grows faster than the size of the input.
This is the root cause of timeouts noted at T204606#5484240, which led to the transforms being disabled on large pages (T248796), which is very sad because it's exactly those pages that would benefit the most from them.
I'd like to fix this.
Acceptance criteria
- Switch implementation from getElementsByTagName() to DOMCompat::querySelectorAll()
- Check performance dashboards and confirm no unexpected problems
- Config change: Increase the limit, benchmark frontend performance on large articles before/after change.
QA
- Check the lead paragraph transform is still running
- Check images are still transformed for lazy loading
- Check sections are still collapsible