update the demo tests result with the latest data

This commit is contained in:
lionsoul2014 2026-01-25 14:37:50 +08:00
parent e139731d9e
commit c2bb78aecd
4 changed files with 32 additions and 16 deletions

View File

@ -177,7 +177,7 @@ ip2region xdb searcher test program
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
type 'quit' to exit
ip2region>> 1.2.3.4
{region: 美国|华盛顿|0|谷歌, io_count: 7, took: 0μs}
{region: Australia|Queensland|Brisbane|0|AU, io_count: 5, took: 0μs}
```
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
@ -187,7 +187,9 @@ ip2region xdb searcher test program
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
type 'quit' to exit
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
{region: 中国|广东省|深圳市|家庭宽带, io_count: 8, took: 0μs}
{region: 中国|广东省|深圳市|电信|CN, io_count: 8, took: 0μs}
ip2region>> 2604:a840:3::a04d
{region: United States|California|San Jose|xTom|US, io_count: 13, took: 0μs}
```
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。

View File

@ -91,7 +91,7 @@ end
-- 2、调用查询 API 进行查询IPv4 和 IPv6 都支持
local ip_str = "1.2.3.4"
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
local s_time = xdb.now()
region, err = searcher:search(ip_str)
local c_time = xdb.now() - s_time
@ -135,7 +135,7 @@ end
-- 3、调用查询 API IPv4 和 IPv6 都支持
local ip_str = "1.2.3.4"
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
local s_time = xdb.now()
region, err = searcher:search(ip_str)
local c_time = xdb.now() = s_time
@ -179,7 +179,7 @@ end
-- 3、调用查询 API IPv4 和 IPv6 都支持
local ip_str = "1.2.3.4"
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
local s_time = xdb.now()
region, err = searcher:search(ip_str)
local c_time = xdb.now() - s_time
@ -219,8 +219,10 @@ options:
ip2region xdb searcher test program
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
type 'quit' to exit
ip2region>> 1.2.3.4
{region: Australia|Queensland|Brisbane|0|AU, io_count: 5, took: 17μs}
ip2region>> 120.229.45.2
{region: 中国|广东省|深圳市|移动, io_count: 3, took: 34μs}
{region: 中国|广东省|深圳市|移动|CN, io_count: 3, took: 40μs}
```
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 查询测试:
@ -232,7 +234,9 @@ type 'quit' to exit
ip2region>> ::
{region: , io_count: 1, took: 48μs}
ip2region>> 240e:3b7:3276:33b0:958f:f34c:d04f:f6a
{region: 中国|广东省|深圳市|家庭宽带, io_count: 8, took: 51μs}
{region: 中国|广东省|深圳市|电信|CN, io_count: 8, took: 52μs}
ip2region>> 2604:a840:3::a04d
{region: United States|California|San Jose|xTom|US, io_count: 13, took: 35μs}
```
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。

View File

@ -68,7 +68,7 @@ try {
// 2, 查询IPv4 或者 IPv6 的地址都支持
try {
$ip = '1.2.3.4';
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
// $ip = ""240e:3b7:3272:d8d0:db09:c067:8d59:539e; // IPv6
$sTime = Util::now();
$region = $searcher->search($ip);
$costMs = Util::now() - $sTime;
@ -111,7 +111,7 @@ try {
// 3、查询IPv4 或者 IPv6 都支持
try {
$ip = '1.2.3.4';
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
// $ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
$sTime = Util::now();
$region = $searcher->search($ip);
$costMs = Util::now() - $sTime;
@ -153,7 +153,7 @@ try {
// 3、查询IPv4 或者 IPv6 都支持
try {
$ip = '1.2.3.4';
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
// $ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
$sTime = Util::now();
$region = $searcher->search($ip);
$costMs = Util::now() - $sTime;
@ -186,8 +186,10 @@ options:
ip2region xdb searcher test program
source xdb file: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
type 'quit' to exit
ip2region>> 1.2.3.4
{region: Australia|Queensland|Brisbane|0|AU, ioCount: 5, took: 0.12695 ms}
ip2region>> 120.229.45.2
{region: 中国|广东省|深圳市|移动, ioCount: 3, took: 0.02783 ms}
{region: 中国|广东省|深圳市|移动|CN, ioCount: 3, took: 0.07397 ms}
```
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 的查询测试:
@ -199,7 +201,9 @@ type 'quit' to exit
ip2region>> ::
{region: , ioCount: 1, took: 0.08887 ms}
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
{region: 中国|广东省|深圳市|家庭宽带, ioCount: 8, took: 0.09595 ms}
{region: 中国|广东省|深圳市|电信|CN, ioCount: 8, took: 0.10303 ms}
ip2region>> 2604:a840:3::a04d
{region: United States|California|San Jose|xTom|US, ioCount: 13, took: 0.04614 ms}
```
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。

View File

@ -177,7 +177,9 @@ ip2region xdb searcher test program
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
type 'quit' to exit
ip2region>> 1.2.3.4
{region: 美国|华盛顿|0|谷歌, ioCount: 7, took: 185 μs}
{region: Australia|Queensland|Brisbane|0|AU, ioCount: 5, took: 188 μs}
ip2region>> 113.118.113.77
{region: 中国|广东省|深圳市|电信|CN, ioCount: 2, took: 143 μs}
```
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
@ -186,8 +188,12 @@ ip2region>> 1.2.3.4
ip2region xdb searcher test program
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
type 'quit' to exit
ip2region>> ::
{region: , ioCount: 1, took: 166 μs}
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
{region: 中国|广东省|深圳市|家庭宽带, ioCount: 8, took: 211 μs}
{region: 中国|广东省|深圳市|电信|CN, ioCount: 8, took: 197 μs}
ip2region>> 2604:a840:3::a04d
{region: United States|California|San Jose|xTom|US, ioCount: 13, took: 240 μs}
```
输入 ip 即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。