项目目录调整,开源协议修改 GPLv3 -> MIT

This commit is contained in:
John
2017-11-22 16:02:50 +08:00
parent c075c395f8
commit d2bc721fb9
94 changed files with 10878 additions and 373 deletions

View File

@ -0,0 +1,31 @@
package main
import (
"testing"
"g/encoding/gjson"
"encoding/json"
"log"
)
// go test json_test.go -bench=".*"
var data = `[{"CityId":1, "CityName":"北京", "ProvinceId":1, "CityOrder":1}, {"CityId":5, "CityName":"成都", "ProvinceId":27, "CityOrder":1}]`
func BenchmarkJsonDecode(b *testing.B) {
b.N = 1000000
for i := 0; i < b.N; i++ {
gjson.Decode(data)
}
}
func BenchmarkJsonDecodeByUnmarshal(b *testing.B) {
b.N = 1000000
for i := 0; i < b.N; i++ {
var citys interface{}
if err := json.Unmarshal([]byte(data), &citys); err != nil {
log.Fatalf("JSON unmarshaling failed: %s", err)
}
//fmt.Println(citys)
}
}