Skip to content

webdriver: Improve input event synchronization time-complexity from O(N²) to O(N)#42309

Merged
jdm merged 3 commits intoservo:mainfrom
yezhizhen:simplify-mixed-wait
Feb 3, 2026
Merged

webdriver: Improve input event synchronization time-complexity from O(N²) to O(N)#42309
jdm merged 3 commits intoservo:mainfrom
yezhizhen:simplify-mixed-wait

Conversation

@yezhizhen
Copy link
Copy Markdown
Member

@yezhizhen yezhizhen commented Feb 3, 2026

  • Rename wait_for_user_agent_handling_complete to wait_for_input_event_handled
  • Reduce the time-complexity from $O(N^2)$ to $O(N)$: we are waiting for all pending_input_event_receivers anyway. There is no need for crossbeam_channel::Select as the sender won't block, and channel is unbound.
  • Add a TODO: Some DOM events may not have been produced at the end of wait.

Testing: This is refactor. https://github.com/servo/servo/actions/runs/21627646437

Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
@yezhizhen yezhizhen requested a review from xiaochengh February 3, 2026 11:30
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 3, 2026
@yezhizhen yezhizhen changed the title webdriver: Improve input event synchronization from $O(N^2)$ to $O(N)$ webdriver: Improve input event synchronization from O(N²) to O(N) Feb 3, 2026
@yezhizhen yezhizhen changed the title webdriver: Improve input event synchronization from O(N²) to O(N) webdriver: Improve input event synchronization time-complexity from O(N²) to O(N) Feb 3, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Feb 3, 2026
@jdm jdm added this pull request to the merge queue Feb 3, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 3, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
…(N²) to O(N) (#42309)

- Rename `wait_for_user_agent_handling_complete` to
`wait_for_input_event_handled`
- Reduce the time-complexity from $O(N^2)$ to $O(N)$: we are waiting for
all `pending_input_event_receivers` anyway. There is no need for
`crossbeam_channel::Select` as the sender won't block, and channel is
`unbound`.
- Add a TODO: Some DOM events may not have been produced at the end of
wait.

Testing: This is refactor.
https://github.com/servo/servo/actions/runs/21627646437

---------

Signed-off-by: Euclid Ye <[email protected]>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 3, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 3, 2026
@jdm jdm added this pull request to the merge queue Feb 3, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Feb 3, 2026
Merged via the queue into servo:main with commit 67e601b Feb 3, 2026
44 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 3, 2026
@yezhizhen yezhizhen deleted the simplify-mixed-wait branch February 4, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants