gf/util/gconv/gconv_z_bench_struct_test.go
2020-11-08 00:06:05 +08:00

33 lines
626 B
Go

// Copyright 2017-2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
// go test *.go -bench=".*" -benchmem
package gconv
import (
"testing"
)
type structType struct {
Name string
Score int
}
var (
structMap = map[string]interface{}{
"name": "gf",
"score": 100,
}
structPointer = new(structType)
)
func Benchmark_Struct_Basic(b *testing.B) {
for i := 0; i < b.N; i++ {
Struct(structMap, structPointer)
}
}