Skip to content

perf: Use NonZeroU16 for port numbers #930

Open
@DonIsaac

Description

@DonIsaac

Changing URL's port field from Option<u16> to Option<NonZeroU16> would enable some memory layout optimizations, allowing port to have the same size as u16. Trying this out locally results in a 10% smaller memory footprint for Url (88 bytes -> 80 bytes).

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