2 Star 0 Fork 70

golang-package/carbon

forked from dromara/carbon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
carbon_bench_test.go 564 Bytes
一键复制 编辑 原始数据 按行查看 历史
kuafuRace 提交于 2个月前 . test: Optimize test cases
package carbon
import (
"testing"
"time"
)
func BenchmarkNewCarbon(b *testing.B) {
loc, _ := time.LoadLocation(PRC)
t, _ := time.ParseInLocation(DateTimeLayout, "2020-08-05 13:14:15", loc)
b.Run("without time", func(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
NewCarbon()
}
})
b.Run("with time", func(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
NewCarbon(t)
}
})
}
func BenchmarkCopy(b *testing.B) {
c := Parse("2020-08-05").SetLocale("zh-CN")
b.ResetTimer()
for n := 0; n < b.N; n++ {
c.Copy()
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/golang-package/carbon.git
git@gitee.com:golang-package/carbon.git
golang-package
carbon
carbon
master

搜索帮助