optimize completion sink accepted path (#4262)#4262
Open
mariusae wants to merge 2 commits into
Open
Conversation
Contributor
|
@mariusae has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108622923. |
7e7acee to
7e3b9aa
Compare
mariusae
added a commit
to mariusae/monarch
that referenced
this pull request
Jun 19, 2026
Summary: Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion. ghstack-source-id: 393929683 exported-using-ghexport Reviewed By: andrewjcg Differential Revision: D108622923
mariusae
added a commit
to mariusae/monarch
that referenced
this pull request
Jun 19, 2026
Summary: Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion. ghstack-source-id: 393929683 exported-using-ghexport Reviewed By: andrewjcg Differential Revision: D108622923
Summary: Replace the implicit oneshot-based channel return path with an explicit `SendCompletion` / `CompletionSink` contract. `Tx::do_post` now receives a concrete completion sink, `post()` uses `CompletionSink::ignore()`, and `try_post()` adapts the existing oneshot API through `CompletionSink::oneshot()`. Add explicit `accept()` and `reject()` calls at channel terminal points, and use `contramap_rejected()` for adapters such as `AttachTx` so accepted completions pass through unchanged while rejected wrapped messages are translated back to their outer message type. Convert `MailboxClient` to observe completions directly with `CompletionSink::callback()`, removing the per-message task that waited on a return-channel oneshot while preserving undeliverable handling and flush notification. ghstack-source-id: 393929682 exported-using-ghexport Reviewed By: andrewjcg Differential Revision: D108622920
Summary: Make the accepted completion path cheap by replacing the generic `SendCompletion` callback sink with explicit rejection-oriented sink variants. `CompletionSink::ignore()` and accepted oneshot completions now avoid callback dispatch, `contramap_rejected()` preserves `Ignore` without allocation, and `MailboxClient` uses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion. ghstack-source-id: 393929683 exported-using-ghexport Reviewed By: andrewjcg Differential Revision: D108622923
7e3b9aa to
238988a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Make the accepted completion path cheap by replacing the generic
SendCompletioncallback sink with explicit rejection-oriented sink variants.CompletionSink::ignore()and accepted oneshot completions now avoid callback dispatch,contramap_rejected()preservesIgnorewithout allocation, andMailboxClientuses a tracked rejection sink so accepted completions only perform the required flush counter update and notification while rejection still runs the undeliverable conversion.ghstack-source-id: 393929683
exported-using-ghexport
Reviewed By: andrewjcg
Differential Revision: D108622923