Search code examples
c++dnsreverse-dns

What is the time cost of getaddrinfo()?


I am using getaddrinfo() API to resolve DNS queries in a cross platform C++ app. I need to know the time cost of getaddrinfo() in different platforms? Can anyone help me on this?


Solution

  • This function does not have algorithmic complexity because it is not doing any complex computation inside. The best you should take measurements on the systems/platforms that you are using and base your expectations on this.

    The result will drastically vary depending on the network that you have. Imagine system that has a slow dial-up connection. Its speed will not have anything in common with fast LAN and DNS server sitting on the same LAN.