2 Star 0 Fork 70

golang-package/carbon

forked from dromara/carbon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
parser_bench_test.go 799 Bytes
一键复制 编辑 原始数据 按行查看 历史
package carbon
import (
"testing"
)
func BenchmarkParse(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
Parse("2020-08-05 01:02:03")
}
}
func BenchmarkParseByLayout(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
ParseByLayout("2020-08-05 13:14:15", DateTimeLayout)
}
}
func BenchmarkParseByFormat(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
ParseByFormat("2020-08-05 13:14:15", DateTimeFormat)
}
}
func BenchmarkParseByLayouts(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
ParseByLayouts("2020-08-05 13:14:15", []string{DateLayout, DateTimeLayout})
}
}
func BenchmarkParseByFormats(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
ParseByFormats("2020-08-05 13:14:15", []string{DateFormat, DateTimeFormat})
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/golang-package/carbon.git
git@gitee.com:golang-package/carbon.git
golang-package
carbon
carbon
master

搜索帮助