Skip to main content

Performance

Signal session cache: Arc-shared records, zero-copy peek_session (#809) SessionEntry::Present now wraps Arc<SessionRecord> instead of Box<SessionRecord>, aligning sessions with the sender-key cache pattern already in use. peek_session — the non-destructive read used by retry-receipt handling and LID-migration checks — previously deep-cloned the full SessionRecord on every call (1–2 KB: archived session states plus skipped message keys). It now returns Option<Arc<SessionRecord>>, so a cache hit is a refcount bump. The backend-miss path wraps the deserialized record once in Arc and shares the same allocation between the cache slot and the return value, eliminating a second clone the old code always paid. get_session (checkout) uses Arc::try_unwrap to move the record out in the common case — the entry is unique in steady state, so this is a zero-cost move. A clone only occurs when a peek’s short-lived Arc is still alive at checkout time (the rare overlap the old code paid for on every peek).

Breaking changes

peek_session return type: Option<SessionRecord>Option<Arc<SessionRecord>> (pre-1.0) Read-only consumers are source-compatible via Deref — code that only reads through the returned value compiles unchanged. Code that requires an owned SessionRecord (e.g., passing by value to a function) should dereference and clone: (*arc).clone().