mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-09-27 05:05:53 +08:00

对一般用户而言,还是需要使用Info等级 来了解一下 一般的 日志情况,等到使用熟练之后,且确认运行没有错误后, 可以自行调为 warning 来提升性能 发现 bubble包 还自己引入了 命令行参数,这十分不可取,所以我们还是直接使用其代码。 将其它包中 的 命令行参数 统一 移动 到 cmd/verysimple 中;tls lazy 特性因为还在 调试阶段,所以 命令行参数 仍然放到 v2ray_simple 包中。
39 lines
862 B
Go
39 lines
862 B
Go
package netLayer
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/e1732a364fed/v2ray_simple/utils"
|
|
)
|
|
|
|
/* go test -bench "CheckMMDB_country" . -v
|
|
BenchmarkCheckMMDB_country-8 3631854 315.3 ns/op
|
|
|
|
总之一次mmdb查询比map查询慢了十倍多 (见 以前代码的 utils/container_test.go.bak, 新代码已经删掉了,可以找老 tag 找到。)
|
|
|
|
有必要设置一个 国别-ip 的map缓存; 不过这种纳秒级别的优化就无所谓了; 也不好说,谁知道客户端的cpu有多垃圾
|
|
*/
|
|
|
|
func BenchmarkCheckMMDB_country(b *testing.B) {
|
|
|
|
GeoipFileName = "GeoLite2-Country.mmdb"
|
|
|
|
b.StopTimer()
|
|
b.ResetTimer()
|
|
LoadMaxmindGeoipFile(utils.GetFilePath("../" + GeoipFileName))
|
|
|
|
if the_geoipdb == nil {
|
|
b.Log("err load")
|
|
b.FailNow()
|
|
}
|
|
|
|
theIP := net.ParseIP("1.22.233.44")
|
|
|
|
b.StartTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
GetIP_ISO(theIP)
|
|
}
|
|
}
|