/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
os/gstructs/gstructs_z_bench_test.go
36 строк
809 B
John Guo
expose package internal/structs as os/gstructs; add package gtag for custom tag storage feature
24 ноя 2021, 11:17
24 ноя 2021, 11:17
7b22355
Код
Авторство
О чём код?
// Copyright GoFrame Author(https://goframe.org). 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. package gstructs_test import ( "testing" "github.com/gogf/gf/v2/os/gstructs" ) type User struct { Id int Name string `params:"name"` Pass string `my-tag1:"pass1" my-tag2:"pass2" params:"pass"` } var ( user = new(User) userNilPointer *User ) func Benchmark_TagFields(b *testing.B) { for i := 0; i < b.N; i++ { gstructs.TagFields(user, []string{"params", "my-tag1"}) } } func Benchmark_TagFields_NilPointer(b *testing.B) { for i := 0; i < b.N; i++ { gstructs.TagFields(&userNilPointer, []string{"params", "my-tag1"}) } }