Repository navigation
perf(macros): #[inline] the generated immediate dispatch - #296
Conversation
🤖 Gemini Code ReviewThe change looks good. Adding Automated review by Gemini · gemini-4-argon · custom prompt · 795 in / 671 out · ~$0.01 |
🤖 Kimi Code ReviewNo findings. The Automated review by Kimi (Moonshot AI) · kimi-k3.1-pro · custom prompt · 772 in / 535 out · ~$0.01 |
🤖 Claude Code ReviewReview: PR #296,
|
🤖 DeepSeek Code ReviewI only have the diff to review, but the change is straightforward and isolated. Summary
CorrectnessThe generated attribute is syntactically valid and does not change runtime semantics. PerformanceThe rationale in the comment and changelog is clear: after the module split in #278 the compiler stopped inlining this dispatch function, causing a measurable instruction-count regression. Adding Minor considerations
VerdictLGTM. The change is a small, well-explained compiler hint with no apparent correctness or concurrency concerns. Automated review by DeepSeek · deepseek-v4-pro · custom prompt · 804 in / 3.3k out · ~$0.01 |
🤖 Codex Code ReviewNo findings. The added The benchmark improvements reported in the changelog were not independently verified. Automated review by OpenAI Codex · gpt-6.1-sol · custom prompt · 37.6k in / 250 out · ~$0.03 |
🤖 Grok Code ReviewThis change is sound.
No concurrency or safety issues: inlining a The source comment is worth keeping so the attribute is not dropped as redundant. It lives in the macro source, not in expanded user code. Automated review by Grok (xAI) · grok-4.7 · custom prompt · 1.9k in / 3.2k out · ~$0.02 |
After the module split (#278) the compiler stopped inlining __spawned_handle_immediate into SendEnvelope::handle, adding 22 instructions per send: +3.6% over v0.8.0 on async_ct_send_p1/p2, which the cumulative perf budget against the release would fail. With the hint, handler body and reply() inline again and every gated async benchmark is below v0.8.0.
935e22b to
c23a8ea
Compare
Since the module split (#278), rustc no longer inlines the
#[actor]-generated__spawned_handle_immediateintoSendEnvelope::handle. v0.8.0 inlined the handler body intohandle(14 Ir) and calledPendingReply::replyout of line (17 Ir). main calls__spawned_handle_immediateout of line (22 Ir) from a biggerhandle(30 Ir). That is +22 Ir persend, +3.6% over v0.8.0 onasync_ct_send_p1/p2, plus +0.4% to +1.2% on the async request benchmarks. The macro is the same in both versions, so this is a codegen change caused by the new module layout, not new work on the hot path. Bisected on fede: every commit up tod79c041bmatches v0.8.0, and8bbe1c72(#278) is where it changes.With
#[inline]on the generated method, handler, dispatch andreply()all inline into a 9-Irhandle. Callgrind on fede (gate harness, base main, release v0.8.0):Without this fix, main fails the cumulative release budget in #295.
cargo test -p spawned-concurrency -p spawned-macrospasses on fede, including trybuild andimmediate_dispatch.Model: no change because an inlining hint changes no behaviour.