github.com/zhongdalu/gf@v1.0.0/g/encoding/gjson/gjson_z_bench_test.go (about) 1 // Copyright 2017 gf Author(https://github.com/zhongdalu/gf). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/zhongdalu/gf. 6 7 package gjson_test 8 9 import ( 10 "github.com/zhongdalu/gf/g/encoding/gjson" 11 "testing" 12 ) 13 14 func Benchmark_Set1(b *testing.B) { 15 for i := 0; i < b.N; i++ { 16 p := gjson.New(map[string]string{ 17 "k1": "v1", 18 "k2": "v2", 19 }) 20 p.Set("k1.k11", []int{1, 2, 3}) 21 } 22 } 23 24 func Benchmark_Set2(b *testing.B) { 25 for i := 0; i < b.N; i++ { 26 p := gjson.New([]string{"a"}) 27 p.Set("0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0", []int{1, 2, 3}) 28 } 29 }