Skip to content

macos get_interfaces is extremly slow with larger amount of interfaces (sometimes) #143

@dignifiedquire

Description

@dignifiedquire

I am currently debugging a slow down in gathering network interfaces, and found the following

If I modify to the list_interfaces example to measure the time it takes for the call to get_interfaces I get the following results

Default implementation on macos

  • got interfaces 21 after 3.3814s (sometimes this is even more, I have seen up to 15 seconds)

When I use ifconfig the results are instant. So I looked at https://github.com/apple-oss-distributions/network_cmds/blob/main/ifconfig.tproj/ifconfig.c and found it uses getifaddr instead of the framework APIs currently being used.

I then switched the call in interfaces::interfaces() to use

crate::os::unix::interface::unix_interfaces()

instead and got in the example a much more reasonable

  • got interfaces 21 after 0.0003s

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions