Which source are you using? If you’re using the Maxmind file-based (automatic), 600ms seems too much. Web-based sources will have this (hostinfo/Maxmind Precision).
Defer the lookup to do it after the page load will be possible when the AJAX functionality is ready. https://wordpress.org/support/topic/js-api/ But as you see there, I cannot say when I come to it …
That’s the one I’m using (file-based, automatic). AJAX functionality would be great, I’ll keep an eye out for updates from you. π
I was trying to delay it myself using jQuery, and at one point an external file with the lookup in it, but it didn’t work like I wanted it to. I’m not very good. :p
There is a proof of concept in the AJAX thread of this – I didn’t try it but I suspect it works …
But 600ms for a file-based lookup is still surprising to me (in my test it was < 10ms).
If you do the lookup in the backend (Lookup module), does he also indicate a lookup time of 600ms? If not I wonder where this extra time is coming from. Or is it the initialization of the plugin, i.e. difference between activated or not activated, even if there is no lookup in the code?
When I tested in the backend, it says “Lookup duration: 0.01046 s”.
This is what I have in the code: [geoip_detect2_get_client_ip] – [geoip_detect2 property=’city’] [geoip_detect2 property=’country’]
If I remove those shortcodes, it goes down from ~610 ms wait to ~10 ms for the page. Not sure what specifically is causing it.
10ms sounds like you are using a page cache? In this case yes it does make a big difference if any GeoIP code is included or not – because the plugin automatically tells the caching system to not cache this page. So yes, your only option is the AJAX way above.