Skip to content

refactor(io): optimize waker array - #878

Merged
George-Miao merged 2 commits into
compio-rs:masterfrom
Berrysoft:refactor/waker-array
Apr 18, 2026
Merged

George-Miao merged 2 commits into
compio-rs:masterfrom
Berrysoft:refactor/waker-array

Conversation

@Berrysoft

Copy link
Copy Markdown
Member

Close #865

The compio-ws one will be removed by #875

@Berrysoft Berrysoft added this to the v0.19 milestone Apr 18, 2026
@Berrysoft
Berrysoft requested a review from Copilot April 18, 2026 10:49
@Berrysoft Berrysoft self-assigned this Apr 18, 2026
@Berrysoft Berrysoft added package: io Related to compio-io refactor Refactoring existing code labels Apr 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors compio-io’s futures-compat AsyncStream waker aggregation to reduce per-poll allocations by introducing a lightweight “array of wakers” wrapper and using it during internal polling.

Changes:

  • Add compat::waker_array with WakerArrayRef (custom RawWaker implementation).
  • Update compat::AsyncStream internals to build a combined waker from stored read/write-related wakers without allocating an Arc per poll.
  • Wire the new module into compat (mod waker_array;).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
compio-io/src/compat/waker_array.rs Introduces WakerArrayRef and an owned Wake implementation used when cloned.
compio-io/src/compat/async_stream.rs Switches internal polling to use WakerArrayRef instead of allocating an Arc-backed Wake.
compio-io/src/compat/mod.rs Adds the new waker_array module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread compio-io/src/compat/waker_array.rs Resolved
Comment thread compio-io/src/compat/async_stream.rs Resolved
Comment thread compio-io/src/compat/waker_array.rs Resolved
Comment thread compio-io/src/compat/waker_array.rs Resolved
@Berrysoft
Berrysoft requested a review from George-Miao April 18, 2026 12:46
Comment thread compio-io/src/compat/waker_array.rs Resolved
@Berrysoft
Berrysoft requested a review from George-Miao April 18, 2026 15:04

@George-Miao George-Miao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@George-Miao
George-Miao added this pull request to the merge queue Apr 18, 2026
Merged via the queue into compio-rs:master with commit c8ba460 Apr 18, 2026
71 checks passed
@Berrysoft
Berrysoft deleted the refactor/waker-array branch April 18, 2026 15:08
This was referenced Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: io Related to compio-io refactor Refactoring existing code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(io,ws): Optimize WakerArray

3 participants