号段归属地格式详解
超高性能 qqzeng-phone-3.0.dat
编码:UTF8 字节序:Little-Endian
返回多个字段信息(如:广东|深圳|518000|0755|440300|移动)
------------------------ 文件结构 ---------------------------
//文件头 20字节 4-4-4-4-4[前缀数量][号段数量][内容区长度][运营商区长度][版本:20211201]
//内容区 长度无限制[地区信息][地区信息]……唯一不重复
//运营商区 长度无限制[运营商][运营商]……唯一不重复
//前缀区 7字节(1-4-2)[号段前三位][索引区start索引][索引区个数]
//索引区 4字节(2-2)[号段后四位][地区索引+运营商索引(不足补0)]
------------------------ 文件结构 ---------------------------
优势:压缩形式将数据存储在内存中,通过减少将相同数据读取到内存的次数来减少I/O.
较高的压缩率通过使用更小的内存中空间提高查询性能。
解析出来一次性加载到二维数组中,查询性能提高1倍!
压缩:原版txt为23M,生成dat结构为1.8M,上一版为3.2M
性能:每秒解析1000w+
对比:相比其他dat更简洁更高效
创建:qqzeng-phone-3.0 于 2021-12-12
2.0-6.0 版本 性能比较
测试环境:Apple M4 Max macOS x64 14 核 CPU 2025
时间复杂度: O (log n) 到 O (1)
查询 qqzeng-phone-2.0.dat 8932万 ->6.682秒 每秒1336.7255312780603万次查询
qqzeng-phone-2.0.dat 11310万 ->8.235秒 每秒1373.4061930783243万次查询
qqzeng-phone-2.0.dat 11136万 ->8.24秒 每秒1351.4563106796115万次查询
qqzeng-phone-2.0.dat 8526万 ->6.176秒 每秒1380.5051813471503万次查询
qqzeng-phone-2.0.dat 10962万 ->7.917秒 每秒1384.6153846153848万次查询
qqzeng-phone-2.0.dat 11020万 ->7.947秒 每秒1386.6868000503334万次查询
qqzeng-phone-2.0.dat 7192万 ->5.17秒 每秒1391.10251450677万次
查询 qqzeng-phone-3.0.dat 8236万 ->2.824秒 每秒2916.43059490085万次查询
qqzeng-phone-3.0.dat 9280万 ->3.129秒 每秒2965.803771172899万次查询
qqzeng-phone-3.0.dat 6902万 ->2.315秒 每秒2981.4254859611233万次查询
qqzeng-phone-3.0.dat 7424万 ->2.565秒 每秒2894.346978557505万次查询
qqzeng-phone-3.0.dat 11426万 ->3.931秒 每秒2906.6395319257185万次查询
qqzeng-phone-3.0.dat 6496万 ->2.251秒 每秒2885.8285206574856万次查询
qqzeng-phone-3.0.dat 11252万 ->3.849秒 每秒2923.3567160301377万次
查询 qqzeng-phone-4.0.dat 7308万 ->1.201秒 每秒6084.929225645295万次查询
qqzeng-phone-4.0.dat 5800万 ->0.954秒 每秒6079.664570230609万次查询
qqzeng-phone-4.0.dat 7308万 ->1.186秒 每秒6161.888701517707万次查询
qqzeng-phone-4.0.dat 8352万 ->1.328秒 每秒6289.156626506024万次查询
qqzeng-phone-4.0.dat 9860万 ->1.582秒 每秒6232.616940581542万次查询
qqzeng-phone-4.0.dat 9802万 ->1.57秒 每秒6243.312101910828万次查询
qqzeng-phone-4.0.dat 7018万 ->1.14秒 每秒6156.140350877194万次
查询 qqzeng-phone-5.0.dat 7888万 ->0.376秒
每秒20978.723404255317万次查询 qqzeng-phone-5.0.dat 11136万 ->0.529秒
每秒21051.039697542532万次查询 qqzeng-phone-5.0.dat 6322万 ->0.296秒
每秒21358.10810810811万次查询 qqzeng-phone-5.0.dat 7366万 ->0.346秒
每秒21289.017341040464万次查询 qqzeng-phone-5.0.dat 9512万 ->0.449秒
每秒21184.855233853006万次查询 qqzeng-phone-5.0.dat 8410万 ->0.395秒
每秒21291.139240506327万次查询 qqzeng-phone-5.0.dat 6728万 ->0.313秒
每秒21495.20766773163万次
查询 qqzeng-phone-6.0.db 6786万 ->0.409秒 每秒16591.687041564794万次查询
qqzeng-phone-6.0.db 9106万 ->0.544秒 每秒16738.970588235294万次查询
qqzeng-phone-6.0.db 8700万 ->0.522秒 每秒16666.666666666664万次查询
qqzeng-phone-6.0.db 6844万 ->0.41秒 每秒16692.682926829268万次查询
qqzeng-phone-6.0.db 9164万 ->0.55秒 每秒16661.81818181818万次查询
qqzeng-phone-6.0.db 6496万 ->0.385秒 每秒16872.727272727272万次查询
qqzeng-phone-6.0.db 9512万 ->0.571秒 每秒16658.493870402803万次
存储与性能
极致压缩版本 格式 体积 压缩率原始数据 TXT 30 MB -v6.0 DAT 1.28
MB ▸ 95.7%v3.0 DAT 1.95 MB ▸ 93.5%v2.0 DAT 2.40 MB ▸ 92.0%⚡
性能突破解析速度:超5,000万次/秒(较传统方案快200%)资源占用:内存消耗<10MB,适配高并发场景架构优势:二进制DAT格式实现近O(1)时间复杂度查询