package ip2region import ( "fmt" "github.com/lionsoul2014/ip2region/binding/golang/ip2region" "testing" ) var r *ip2region.Ip2Region func init() { var err error r, err = ip2region.New("../../conf/ip2region.db") if err != nil { fmt.Printf("%s", err) } } func BenchmarkIp2Region(b *testing.B) { ip := "36.161.36.225" for i := 0; i < b.N; i++ { r.MemorySearch(ip) } }