Re: Error due to the "Automatic Mirror Select" function...
| From: | Gabor Hojtsy | Date: | Sun, 25 May 2003 09:25:26 +0000 |
| Subject: | Re: Error due to the "Automatic Mirror Select" function... | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-18048@lists.php.net to get a copy of this message | ||
Hi!
I've been playing around again, and I'm noticing that GeoIP is faster than the direct ip-to-country db. with geoip root@mimbari:~/geoip# php -q findsavage.php 12.253.53.226 Country is United States Lookup of the IP took 0.0390640497208 seconds. root@mimbari:~/geoip# php -q findsavage.php 193.0.0.203 Country is Netherlands Lookup of the IP took 0.0614559650421 seconds. with directi ip-to-country: root@mimbari:~/directi# php -q findsavage.php 12.253.53.226 [directi] Person is located in United States Lookup of the IP took 16.8583329916 seconds and 3 db searches. root@mimbari:~/directi# php -q findsavage.php 193.0.0.203 [directi] Person is located in Netherlands Lookup of the IP took 0.520069003105 seconds and 1 db search. I'm using a Pentium 200Mhz box atm for testing. Will scp the files to the 1600Mhz box and test shortly.That is a surprise to me. I had much better lookup speeds. But the code can be optimized further if that is needed. The index lookup is simple linear search and the db lookup is also a linear search. I used this method, because I am not sure that fseek()ing to different parts of the DB will be faster then fseek()ing deeper into the file continuosly. But BTW we are trying to solve the problem, that IPs are not found. Not optimizing the code. First it needs to work don't you think? BTW I don't know what fseek() will say for a negative offset, but with your patch, those guys with IPs in the first ranges will cause a negative fseek() due to the decrease of the number you have added. Goba