perf: zero-alloc Jid dedup and session lock helper - #500
Conversation
- Add sort_dedup_by_user() and sort_dedup_by_device() to wacore JidExt, replacing HashSet+retain+clone with in-place sort+dedup (0 allocations vs N String clones per group send) - Add session_mutexes_for() helper on Client, deduplicating the 8-line multi-lock acquisition pattern from send.rs and signal.rs - Remove unnecessary to_jid.clone() in group stanza builder (last use)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe PR refactors session lock and deduplication logic across multiple modules by introducing helper methods: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@claude review |
|
Claude finished @jlucaso1's task in 52s —— View job Code Review: perf: zero-alloc Jid dedup and session lock helper
Clean PR — good dedup optimization and nice extraction of the duplicated lock pattern. A few observations:
|
Summary
Zero-alloc Jid dedup
HashSet+retain+.clone()with in-placesort_unstable_by+dedup_bywacore::types::jid:sort_dedup_by_user()andsort_dedup_by_device()resolve_devicesis a batch query, order-independentSession lock helper
session_mutexes_for()on Client, replacing duplicated 8-line lock acquisition pattern insend.rsandsignal.rsMisc
to_jid.clone()in group stanza builder (last use of owned value)Test plan
cargo fmt --allcargo clippy --all --tests— zero warningscargo test --workspace --exclude e2e-tests— 1119 tests passSummary by CodeRabbit