Bug 311672

Summary: Skip full-page anchor scan for conservative-only speculation rules
Product: WebKit Reporter: Basuke Suzuki <basuke>
Component: New BugsAssignee: Basuke Suzuki <basuke>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Basuke Suzuki
Reported 2026-04-07 13:46:17 PDT
processSpeculationRules() scans ALL links on every style recalculation, performing pattern/selector evaluations per anchor. For conservative rules (eagerness: conservative), the result is only consumed at user interaction time (mousedown/pointerdown/keydown). This is wasted work on pages with many links (e.g. magnifiedsand.com with 934 links). This patch defers matching for conservative-only rules to interaction time in HTMLAnchorElement::defaultEventHandler(), skipping the full-page anchor scan in Document::processSpeculationRules() and HTMLAnchorElement::checkForSpeculationRules() when all rules are conservative.
Attachments
Basuke Suzuki
Comment 1 2026-04-07 13:55:25 PDT
Basuke Suzuki
Comment 2 2026-04-07 13:55:40 PDT
EWS
Comment 3 2026-04-08 19:34:23 PDT
Committed 310814@main (5cf7b15948ed): <https://commits.webkit.org/310814@main> Reviewed commits have been landed. Closing PR #62216 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.