Alternate service for ip retrieving 

http://ipecho.net/plain seems to get way better latency than ifconfig.
Check what service suits you better