dnssd icon indicating copy to clipboard operation
dnssd copied to clipboard

mdnsConn.readInto() high cpu usage

Open amurchick opened this issue 2 years ago • 1 comments

I am see periodic high cpu usage of my HimeKit app and I am try to detect what wrong.

As show pprof/profile info - 36% cpu time spend on call net.InterfaceByIndex(): Screen Shot 2022-03-23 at 13 49 05

As I am see from sources https://github.com/brutella/dnssd/blob/master/mdns.go#L233 - net.InterfaceByIndex() called on each udp packet received.

May be cache interfaces info instead of get this info from system on every incoming udp packet?

amurchick avatar Mar 23 '22 08:03 amurchick

Another possibility would be no to call net.InterfaceByIndex at all and only work with the iface.Index (the debug messages will be less clear)

oliverpool avatar Mar 31 '22 11:03 oliverpool