mirror of
https://gitee.com/dromara/carbon.git
synced 2024-12-01 19:58:07 +08:00
26 lines
417 B
Go
Executable File
26 lines
417 B
Go
Executable File
package carbon
|
|
|
|
import "testing"
|
|
|
|
func BenchmarkCarbon_SetTag(b *testing.B) {
|
|
now := Now()
|
|
for n := 0; n < b.N; n++ {
|
|
now.SetTag(&tag{
|
|
carbon: "datetime",
|
|
tz: Local,
|
|
})
|
|
}
|
|
}
|
|
|
|
func BenchmarkCarbon_LoadTag(b *testing.B) {
|
|
type Student struct {
|
|
Birthday Carbon `json:"birthday" carbon:"type:date"`
|
|
}
|
|
student := Student{
|
|
Birthday: Now(),
|
|
}
|
|
for n := 0; n < b.N; n++ {
|
|
_ = LoadTag(&student)
|
|
}
|
|
}
|