diff options
Diffstat (limited to 'vendor/geoip2/geoip2/examples/benchmark.php')
-rw-r--r-- | vendor/geoip2/geoip2/examples/benchmark.php | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/vendor/geoip2/geoip2/examples/benchmark.php b/vendor/geoip2/geoip2/examples/benchmark.php index 7af2a5d..a9273ed 100644 --- a/vendor/geoip2/geoip2/examples/benchmark.php +++ b/vendor/geoip2/geoip2/examples/benchmark.php @@ -1,25 +1,26 @@ -<?php - -require __DIR__ . '/../vendor/autoload.php'; - -use GeoIp2\Database\Reader; - -srand(0); - -$reader = new Reader('GeoIP2-City.mmdb'); -$count = 500000; -$startTime = microtime(true); -for ($i = 0; $i < $count; ++$i) { - $ip = long2ip(rand(0, pow(2, 32) - 1)); - try { - $t = $reader->city($ip); - } catch (\GeoIp2\Exception\AddressNotFoundException $e) { - } - if ($i % 10000 === 0) { - echo $i . ' ' . $ip . "\n"; - } -} -$endTime = microtime(true); - -$duration = $endTime - $startTime; -echo 'Requests per second: ' . $count / $duration . "\n"; +<?php
+
+require __DIR__ . '/../vendor/autoload.php';
+
+use GeoIp2\Database\Reader;
+
+srand(0);
+
+$reader = new Reader('GeoIP2-City.mmdb');
+$count = 500000;
+$startTime = microtime(true);
+for ($i = 0; $i < $count; ++$i) {
+ $ip = long2ip(rand(0, 2 ** 32 - 1));
+
+ try {
+ $t = $reader->city($ip);
+ } catch (\GeoIp2\Exception\AddressNotFoundException $e) {
+ }
+ if ($i % 10000 === 0) {
+ echo $i . ' ' . $ip . "\n";
+ }
+}
+$endTime = microtime(true);
+
+$duration = $endTime - $startTime;
+echo 'Requests per second: ' . $count / $duration . "\n";
|