perf(gateway): share broadcast payload via Arc<str>; scope unregister #103
No reviewers
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom!103
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/85-gateway-arc-payload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the two gateway hot-path costs in #85.
Broadcast payload — one copy, not N
broadcast_to_channel/send_to_user/broadcast_alldidpayload.to_string()per recipient — a fresh heap copy of the same JSON for every subscriber, all under the registry read lock. The outbound channel now carriesArc<str>: the payload is built once and each recipient gets a pointer clone. Lock-held work drops from O(recipients) allocations to O(recipients) refcount bumps. Each connection task materializes an owned socket frame only when it actually writes, off the broadcast path.unregister— touch only joined channelsIt previously scanned every channel's subscription set on each disconnect (O(channels)). A new
connection_channelsindex records what each connection joined, so cleanup touches only those.Tests
unregister_cleans_channel_subscriptions(subscribe to 2 channels → unregister empties both).Arc<str>channel; the shed-slow-consumer and close-signal behavior is unchanged.clippy -D warningsgreen.Closes #85