perf(message): reduce hot-path allocations - #1015
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes optimize device lookup iteration, route selected stanzas through inline handlers, add single-entry message-secret buffering, and implement batched in-memory session updates with tests. ChangesRuntime path and storage updates
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant MessageLoop
participant NodeProcessor
participant InlineHandler
participant ChatLane
MessageLoop->>NodeProcessor: process decrypted node
NodeProcessor->>InlineHandler: handle ack, receipt, or message inline
InlineHandler->>ChatLane: enqueue message for chat
ChatLane-->>InlineHandler: enqueue result
InlineHandler-->>NodeProcessor: handled status and cancellation
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| src/client/node_io.rs | Adds inline fast paths for built-in node handling while keeping observer and waiter gates. |
| src/handlers/message.rs | Extracts the message handler body into a reusable inline method. |
| src/receipt.rs | Moves receipt handling into a synchronous inline helper with the async wrapper preserved. |
| src/msg_secret_buffer.rs | Refactors pending insertion and scheduling, and adds a single-entry queue path. |
| src/send/mod.rs | Uses the single-entry message-secret queue path for outbound secret persistence. |
| src/client/device_registry.rs | Replaces temporary lookup-key vectors with borrowed iterators. |
| wacore/src/store/in_memory.rs | Adds a batched in-memory Signal session write implementation. |
Reviews (1): Last reviewed commit: "perf(message): reduce hot-path allocatio..." | Re-trigger Greptile
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
📦 Binary size report
.text per crate
Top movers (cargo-bloat attribution)
Baseline: |
Summary
async_traitallocationsImpact
DHAT ping-pong allocation cost per cycle dropped from 46,088 to 40,542 bytes (-12.0%) and from 254.84 to 231.60 blocks (-9.1%).
Validation
cargo test -p wacore --libcargo test -p whatsapp-rust --libcargo check -p whatsapp-rust --lib --features tracingcargo clippy -p whatsapp-rust -p wacore --tests -- -D warnings