{"action":"closed","issue":{"url":"https://api.github.com/repos/maxmind/geoip-api-c/issues/75","labels_url":"https://api.github.com/repos/maxmind/geoip-api-c/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/maxmind/geoip-api-c/issues/75/comments","events_url":"https://api.github.com/repos/maxmind/geoip-api-c/issues/75/events","html_url":"https://github.com/maxmind/geoip-api-c/issues/75","id":127995501,"number":75,"title":"[Win32] test/benchmark.c broken","user":{"login":"gvanem","id":945271,"avatar_url":"https://avatars.githubusercontent.com/u/945271?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanem","html_url":"https://github.com/gvanem","followers_url":"https://api.github.com/users/gvanem/followers","following_url":"https://api.github.com/users/gvanem/following{/other_user}","gists_url":"https://api.github.com/users/gvanem/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanem/subscriptions","organizations_url":"https://api.github.com/users/gvanem/orgs","repos_url":"https://api.github.com/users/gvanem/repos","events_url":"https://api.github.com/users/gvanem/events{/privacy}","received_events_url":"https://api.github.com/users/gvanem/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-21T18:58:13Z","updated_at":"2016-01-21T21:27:55Z","closed_at":"2016-01-21T21:27:55Z","body":"This `test/benchmark` program is not working on Windows due to several things:\r\n* Hard-coded paths like `/usr/local/share/GeoIP/GeoIP.dat`.<br>\r\n  IMHO, a macro using `SRCDIR`should be used here.<br>\r\n  Or better, a path based on `GetModuleFileName()` + `../data`.\r\n* MSVC does *not* have `<sys/time.h>`.\r\n* The elapsed time calculation seems broken:<br>\r\n```\r\n   double timerstop()\r\n   {\r\n       __int64 delta;              /* VC6 can't convert an unsigned int64 to to double */\r\n       GetSystemTimeAsFileTime(&timer_t2);\r\n       delta = FILETIME_TO_USEC(timer_t2) - FILETIME_TO_USEC(timer_t2);\r\n       return delta;\r\n   }\r\n  ```\r\n   This return # of micro-seconds, not seconds as the non-Win32 version does.\r\n\r\nAnyway, with some patching [1] of the above, I seems to get very decent results:\r\n```\r\nGeoIP Country\r\n120000 lookups made in 2.149048 seconds\r\nGeoIP Country with GEOIP_CHECK_CACHE\r\n120000 lookups made in 2.118030 seconds\r\nGeoIP Country with GEOIP_MEMORY_CACHE\r\n1200000 lookups made in 21.132135 seconds\r\nGeoIP Country with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE\r\n1200000 lookups made in 21.096256 seconds\r\nGeoIP Region\r\n120000 lookups made in 0.522512 seconds\r\nGeoIP Region with GEOIP_CHECK_CACHE\r\n120000 lookups made in 0.522512 seconds\r\nGeoIP Region with GEOIP_MEMORY_CACHE\r\n1200000 lookups made in 5.223323 seconds\r\nGeoIP Region with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE\r\n1200000 lookups made in 5.212008 seconds\r\nGeoIP Org\r\n60000 lookups made in 0.466460 seconds\r\nGeoIP Org with GEOIP_INDEX_CACHE\r\n240000 lookups made in 1.853766 seconds\r\nGeoIP Org with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE\r\n240000 lookups made in 1.862786 seconds\r\nGeoIP Org with GEOIP_MEMORY_CACHE\r\n600000 lookups made in 4.680498 seconds\r\nGeoIP City\r\n60000 lookups made in 1.884824 seconds\r\nGeoIP City with GEOIP_INDEX_CACHE\r\n240000 lookups made in 7.531220 seconds\r\nGeoIP City with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE\r\n240000 lookups made in 7.524210 seconds\r\nGeoIP City with GEOIP_MEMORY_CACHE\r\n600000 lookups made in 18.783081 seconds\r\n```\r\n\r\nUsing [TDM-gcc](http://tdm-gcc.tdragon.net/) v5.1 with `-O2 -fomit-frame-pointer -ffast-math`.  On Intel i7, 3.5GHz, Win-10,\r\nCan someone on non-Windows with similar hardware confirm these times?\r\n\r\n[1] http://www.watt-32.net/misc/GeoIP-API-C-benchmark.diff\r\n"}}