This test/benchmark program is not working on Windows due to several things:
Hard-coded paths like /usr/local/share/GeoIP/GeoIP.dat.
IMHO, a macro using SRCDIRshould be used here.
Or better, a path based on GetModuleFileName() + ../data.
MSVC does not have <sys/time.h>.
The elapsed time calculation seems broken:
double timerstop()
{
__int64 delta; /* VC6 can't convert an unsigned int64 to to double */
GetSystemTimeAsFileTime(&timer_t2);
delta = FILETIME_TO_USEC(timer_t2) - FILETIME_TO_USEC(timer_t2);
return delta;
}
This return # of micro-seconds, not seconds as the non-Win32 version does.
Anyway, with some patching [1] of the above, I seems to get very decent results:
GeoIP Country
120000 lookups made in 2.149048 seconds
GeoIP Country with GEOIP_CHECK_CACHE
120000 lookups made in 2.118030 seconds
GeoIP Country with GEOIP_MEMORY_CACHE
1200000 lookups made in 21.132135 seconds
GeoIP Country with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE
1200000 lookups made in 21.096256 seconds
GeoIP Region
120000 lookups made in 0.522512 seconds
GeoIP Region with GEOIP_CHECK_CACHE
120000 lookups made in 0.522512 seconds
GeoIP Region with GEOIP_MEMORY_CACHE
1200000 lookups made in 5.223323 seconds
GeoIP Region with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE
1200000 lookups made in 5.212008 seconds
GeoIP Org
60000 lookups made in 0.466460 seconds
GeoIP Org with GEOIP_INDEX_CACHE
240000 lookups made in 1.853766 seconds
GeoIP Org with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE
240000 lookups made in 1.862786 seconds
GeoIP Org with GEOIP_MEMORY_CACHE
600000 lookups made in 4.680498 seconds
GeoIP City
60000 lookups made in 1.884824 seconds
GeoIP City with GEOIP_INDEX_CACHE
240000 lookups made in 7.531220 seconds
GeoIP City with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE
240000 lookups made in 7.524210 seconds
GeoIP City with GEOIP_MEMORY_CACHE
600000 lookups made in 18.783081 seconds
Using TDM-gcc v5.1 with -O2 -fomit-frame-pointer -ffast-math. On Intel i7, 3.5GHz, Win-10,
Can someone on non-Windows with similar hardware confirm these times?
This
test/benchmark
program is not working on Windows due to several things:/usr/local/share/GeoIP/GeoIP.dat
.IMHO, a macro using
SRCDIR
should be used here.Or better, a path based on
GetModuleFileName()
+../data
.<sys/time.h>
.This return # of micro-seconds, not seconds as the non-Win32 version does.
Anyway, with some patching [1] of the above, I seems to get very decent results:
Using TDM-gcc v5.1 with
-O2 -fomit-frame-pointer -ffast-math
. On Intel i7, 3.5GHz, Win-10, Can someone on non-Windows with similar hardware confirm these times?[1] http://www.watt-32.net/misc/GeoIP-API-C-benchmark.diff