Skip to content

Replace max_message_size: Arc<AtomicU32> in the Association struct with a u32 #727

@lucamuscat

Description

@lucamuscat

Hi 👋

As part of my PR introducing support for the max-message-size attribute, I left a comment on a potential improvement where the max_message_size field of the SCTP Association struct can be replaced updated to use a u32, as opposed to an Arc<AtomicU32>, saving us from a sequentially consistent atomic load + fetch and add in a hot path (writing to a datachannel).

My justification for this optimization is that there is no situation where one might want to adjust the max message size that can be sent over an SCTP association after the association has been established. This change will remove the public method set_max_message_size at the benefit of replacing an atomic seq_cst load with a non atomic one.

If you agree with this optimization, I am happy to contribute the necessary changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions