Bug 261209 - Avoid linear search in ScrollingStateTree::insertNode() when node is already present at desired index
Summary: Avoid linear search in ScrollingStateTree::insertNode() when node is already ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-09-06 10:00 PDT by Chris Dumez
Modified: 2023-09-06 15:11 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2023-09-06 10:00:21 PDT
Avoid linear search in ScrollingStateTree::insertNode() when node is already present at desired index.

We used to do a linear search to find the index of `child` and then compare it with `childIndex`. Instead, we now lookup the node at `childIndex` (which is cheap) and compare it to `child`. This allows us to drop some now unused code as well.
Comment 1 Chris Dumez 2023-09-06 10:01:50 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17487
Comment 2 EWS 2023-09-06 15:10:34 PDT
Committed 267698@main (78a45ba1d608): <https://commits.webkit.org/267698@main>

Reviewed commits have been landed. Closing PR #17487 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-09-06 15:11:15 PDT
<rdar://problem/115078904>