Skip to content

Conversation

@shellrow
Copy link
Owner

Summary

Improves interface enumeration performance on macOS.

What changed

  • Parse SystemConfiguration/NetworkInterfaces.plist directly to get extra info
    • Fallback to SystemConfiguration::SCNetworkInterfaceCopyAll if plist parsing fails (compatibility/safety net)
  • Added functional-interface-type lookup using SIOCGIFFUNCTIONALTYPE ioctl
  • Merge the parsed result into unix_interfaces() output

Performance

Measured on my machine (22 interfaces):

Before (release):

  • Total time: ~13–15 ms
  • SCNetworkInterfaceCopyAll: ~12–14 ms

After (release):

  • Total time: ~1.9–2.0 ms
  • Plist parse + merge: ~0.3 ms

Scope

  • macOS only (includes internal refactor shared with iOS)
  • No API changes

@dignifiedquire
Copy link
Contributor

dignifiedquire commented Dec 15, 2025

I can confirm the speedup of listing interfaces (currently 23 on my machine) with this PR

@shellrow shellrow merged commit 0174b8e into main Dec 15, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants