maxmind / geoip-api-c

DEPRECATED GeoIP Legacy C API
Other
371 stars 129 forks source link

[Win32] test/benchmark.c broken #75

Closed gvanem closed 8 years ago

gvanem commented 8 years ago

This test/benchmark program is not working on Windows due to several things:

   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?

[1] http://www.watt-32.net/misc/GeoIP-API-C-benchmark.diff

oschwald commented 8 years ago

Thanks! I fixed a minor issue with how GEOIP_SILENCE was being used, which should improve your results further.

gvanem commented 8 years ago

.. with how GEOIP_SILENCE ..

Duh me! It should off-course be | GEOIP_SILENCE.